Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
No such thing as a small change
 
PerlMonks  

Re^3: Regexp works with some elements and doesn't with others

by mickeyn (Priest)
on Feb 07, 2006 at 10:54 UTC ( #528469=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Regexp works with some elements and doesn't with others
in thread Regexp works with some elements and doesn't with others

Well ... wrong assumption!

you can do it with 'grep' with the help of 'map':

my @tmp = grep { $_->[0] !~ /^The website has been restructured/ } map + { [$text[$_], $arr2[$_], $_] } ( 1 .. $#text ); my @text = map { $_->[0] } @tmp; my @arr2 = map { $_->[1] } @tmp; undef @tmp;
note - this way you create temporary structures (map & grep), so I wouldn't use it on large arrays, but since you wrote it's a 50 elements array ... I guess you can consider this sollution.

Enjoy,
Mickey


Comment on Re^3: Regexp works with some elements and doesn't with others
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (6)
As of 2014-04-16 23:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (436 votes), past polls