Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Problem with pattern match

by George_Sherston (Vicar)
on Jul 09, 2002 at 22:10 UTC ( #180629=note: print w/replies, xml ) Need Help??


in reply to Problem with pattern match

If you're ever likely to want to pull out different ones from the list, you might like to take advantage of the fact that, in array context, a pattern match returns a list of everything that was captured. So
my $s = 'sbs/c/b/cow.bld:three.bld'; my @a = $s =~ /(\w+\.bld)/g; print $a[$#a];
... will print out the one you want, but also leave you with an array with all the others in it as well.

George Sherston

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (11)
As of 2019-07-17 12:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?