Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: simple regex question

by pipeops (Novice)
on Nov 30, 2010 at 15:39 UTC ( #874520=note: print w/ replies, xml ) Need Help??


in reply to simple regex question

All, I ended up using the following method with push. Here it creates 4 arrays from 1 based on its initial character on each line(they are all the same) Thanks everyone for the help foreach $line(@exceptions) { if ($line =~ m/^n/) { $line =~ s/^n//s; push (@before, $line); } if ($line =~ m/^i/) { $line =~ s/^i//s; push (@implementation, $line); } if ($line =~ m/^b/) { $line =~ s/^b//s; push (@backup, $line); } if ($line =~ m/^o/) { $line =~ s/^o//s; push (@offline, $line); } }


Comment on Re: simple regex question
Re^2: simple regex question
by phenom (Chaplain) on Dec 01, 2010 at 00:09 UTC
    pipeops, glad to hear you have it working. But for future reference, please wrap your <code> in tags - it's MUCH easier to read:

    foreach $line (@exceptions) { if ( $line =~ m/^n/ ) { $line =~ s/^n//s; push( @before, $line ); } elsif ( $line =~ m/^i/ ) { $line =~ s/^i//s; push( @implementation, $line ); } elsif ( $line =~ m/^b/ ) { $line =~ s/^b//s; push( @backup, $line ); } elsif ( $line =~ m/^o/ ) { $line =~ s/^o//s; push( @offline, $line ); } }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://874520]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (11)
As of 2014-07-31 16:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (249 votes), past polls