diff --git a/phosta b/phosta
index 28c7ce36fdf5e0c280c18d543e5c80addb82e0c2..dae1db89a8c06c826627cf741a2863906c541a86 100755
--- a/phosta
+++ b/phosta
@@ -14,6 +14,7 @@ use Cwd;
use Getopt::Std;
use File::Spec::Functions;
use File::HomeDir;
+use Data::Dumper;
$Getopt::Std::STANDARD_HELP_VERSION = 'true';
@@ -166,18 +167,16 @@ my $errorcount = 0;
foreach (@lines)
{
chomp $_;
-
my @line = split(/#/, $_);
+
map { s/^\s+|\s+$//g; } @line;
my ($file, $maker, $model, $lensmake, $lens, $lensmodel, $fl, $fl35, $apert, $exposuretime, $ss, $iso, $flash, $datetimeoriginal) = @line;
-
- my @forbidden_content = ('Unknown', 'N/A', '');
-
- grep /$maker/i, @forbidden_content or $maker = '-';
- grep /$model/i, @forbidden_content or $model = '-';
- $lens = grep /$lens/i,@forbidden_content ? $lensmodel : $lens;
- grep /$lens/i, @forbidden_content or $lens = '-';
- $apert = ($apert ne '-') ? sprintf("%.1f", $apert) : $apert;
+ my @forbidden_content = ('Unknown', 'N/A', '', '-');
+ if (!defined($maker) || $maker ~~ @forbidden_content) { $maker = '-'};
+ if (!defined($model) || $model ~~ @forbidden_content) { $model = '-'};
+ if (!defined($lens) || $lens ~~ @forbidden_content) { $lens = $lensmodel };
+ if (!defined($lens) || $lens ~~ @forbidden_content) { $lens = '-' };
+ $apert = ($apert ne '-') ? sprintf("%.1f", $apert) : $apert;
$fl = ($fl ne '-') ? sprintf("%.1f", $fl) : $fl;
$fl35 = ($fl35 ne '-') ? POSIX::lround($fl35) : $fl35;
$exposuretime = (looks_like_number($exposuretime) && $exposuretime < 1 && $exposuretime != 0) ? "1/". POSIX::lround(1/$exposuretime) : $exposuretime;