in reply to Text Extraction Problems
You'll find this more reliable
sub dequote { local *_ = \$_[0]; s/^"(.*)"$/$1/; s/\\(.)/$1/g; } if ($line =~ m/ -([^\S"\\]+) # An dashed identifier (?: # optionally followed by \s+ # whitespace ( # and either "(?:[^"\\]|\\.)*" # a quoted string | # or [^\S"\\]+ # a bare identifer. ) )? /x) { my ($opt, $arg) = ($1, $2); dequote($arg); $DATAFROMBATCHFILE[$counter]{$opt} = $arg; } elsif ($line =~ m/\bEND\b/) { $counter ++; }
You're using a hash as an array again. Are you used to programming in PHP? I fixed it to use an array (meaning I changed {} to []. If the key to a hash is a number, chances are you should be using an array.
|
|---|