Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have a file that read in strings such as
AlarmForwarderServer.exe,app_common.dll,DsCommon.dll,DSGccCommon.dll,D +sRffCommon.dll,DsGccProxy.dll,DsRffProxy.dll,
this is the format per line, the exe followed by a list of dlls. I want to search for the .exe and pust it on @myarray with a [<exe name.}, then I want to keep parsing the string and put the dll under it.
I keep getting compile errors. Here is the code I have.
I know there is probably a one liner out there, but PERL is so new, I'm still coding as if in C++.foreach $line (@exeDllLines) # loop thru list { chomp($line); # chop off trailing newlines #find exe print "$line"; if( $line =~ m/exe/ ) { $line = "[$line]"; push @dllarray, $line; } if( $line =~ m/dll/ ) { push @dllarray, $line; }
Thanks for the help
Edit: g0n Code tags round example data
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: noob regexpression question
by polettix (Vicar) on Nov 07, 2005 at 16:42 UTC | |
by ikegami (Patriarch) on Nov 07, 2005 at 17:10 UTC | |
by polettix (Vicar) on Nov 07, 2005 at 23:55 UTC | |
|
Re: noob regexpression question
by sgifford (Prior) on Nov 07, 2005 at 16:40 UTC | |
|
Re: noob regexpression question
by jdporter (Paladin) on Nov 07, 2005 at 17:45 UTC | |
|
Re: noob regexpression question
by ikegami (Patriarch) on Nov 07, 2005 at 16:41 UTC |