On 5/27/09 Wed May 27, 2009 9:15 AM, "Kirk Wythers" <[email protected]>
scribbled:
> Thanks David. I didn't include my attempts because the postgresql
> stuff took up so many lines. I have snippet out the data read part
> (including your suggestion) and pated below. As you can see I also,
> sent a number of variables in the file. Again I was trying to not fill
> the list with too much text. The error I am getting is: Search pattern
> not terminated at ./untitled.pl line 7.
>
> #!/usr/bin/perl -w
> use strict;
>
> while ( <> ) {
>
> #Part 1. Skip header lines
> next if ( ! m!^\d+/\! );
You are getting an error because you have escaped the final terminator
character (!) of your regular expression: \!, so that the regular expression
parser accepts that as a normal character. Use this instead:
next unless m{ \A \d+ / }x;
which uses the extended regular expression syntax for readability and the
unless operator, which I find more readable than 'if( ! ... )'.
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/