Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Problem with pattern match

by George_Sherston (Vicar)
on Jul 09, 2002 at 22:10 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://180629]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-24 22:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found