Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Tad J McClellan
December 5, 2008, 1:24 pm
rate this thread
@files = @ARGV; # replace all of the above with a single copy
Note that @files contains filenames (strings).
Are you familiar with the "foreach" control structure?
You should be...
See the "Foreach Loops" in perlsyn.pod
Note that @temp also contains filenames (strings).
Note that $file also contains a filename (string).
You should always enable warnings when developing Perl code!
The input operator takes a filehandle not a filename.
my( $var, $vars ) = @_; # a better way of copying arguments
The 2nd (replacement) part of s/// is not a regular expression, it
is a double quotish string.
Parenthesis are not meta in double quoted strings, so you have
more backslashes than you need:
$pattern =~ s/\)/\)/;
If you want the input line in $line, then why put it somewhere else then
copy it rather than simply put it where you want it when you first get it?
while ( my $line = <INFILE> )
Number signs are not meta in regular expressions. You have more
backslashes than you need.
You should not capture if you are not going to use the string
that is captured...
$line =~ s/^\s*#.*//;
Note that this pattern is not the same as the pattern in the while()...
It will change
I have a backslash in the \middle and at the end too\
I have a backslash in the
You can use s/// in the while condition you know:
while ( $line =~ s/\\s*$// )
$line .= " $nextLine";
while ($line =~ /(\w+)\W+/g)
since \w already contains underscore.
email: perl -le "print scalar reverse qq/moc.noitatibaher0cmdat/"