in reply to Regular Expression help, MS Access Pipe delimited export gone bad

From my testing, your code would work fine if you changed the line:

unless ($line =~/JPG?/){ chomp; }

to be:

unless ($line =~/JPG?/){ chomp( $line ); }

Seeing other ways to do what you want is a great way to learn Perl, but it's also nice to know what is going wrong in the code that you write.

HTH.
~CS