in reply to noob regexpression question
I keep getting compile errors.Try to put the following at the beginning of your script:
and you should get better info about what's going wrong. At a first glance, you're missing the foreach closing brace. Please note that using strict obliges you to declare all your variables before you use them, which you should appreciate as a C++ programmer :)use strict; use warnings; use diagnostics;
If each $line contains the whole stuff, you'll have hard times. You should probably split using "," as a separator, then iterate thru the elements:
Note: CODE UNTESTED!!!foreach my $line (@lines) { chomp $line; foreach my $element (split /,/ , $line) { my $extension = substr($element, -3) || ''; if ( $extension eq 'exe' ) { push @dllarray, "[$element]"; } elsif ( $extension eq 'dll' ) { push @dllarray, $element; } } }
Flavio
perl -ple'$_=reverse' <<<ti.xittelop@oivalf
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: noob regexpression question
by ikegami (Patriarch) on Nov 07, 2005 at 17:10 UTC | |
by polettix (Vicar) on Nov 07, 2005 at 23:55 UTC |