Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: simple regex question

by pipeops (Novice)
on Nov 30, 2010 at 15:39 UTC ( [id://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); } }

Replies are listed 'Best First'.
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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://874520]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-25 10:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found