Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: Perl oddities

by gaal (Parson)
on Mar 01, 2005 at 19:16 UTC ( #435579=note: print w/ replies, xml ) Need Help??


in reply to Re: Perl oddities
in thread Perl oddities

Often you can just assign the results of the match. Make sure you are in list context if you have only one capture.

my ($this, $that, $some, $other) = /(this)(that).*(some)....(other)$/; my ($cap) = /hello(there)/; # OK my $cap = /hello(there)/; # BUG

Replies are listed 'Best First'.
Re^3: Perl oddities
by Anonymous Monk on Mar 02, 2005 at 13:38 UTC
    Often you can just assign the results of the match.

    But not if you use /g, as /g acts quite differently in scalar and in list context.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2016-06-26 22:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (331 votes). Check out past polls.