Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Perl Idioms Explained - my $count = () = /.../g

by japhy (Canon)
on Feb 04, 2006 at 19:14 UTC ( #527973=perlmeditation: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $str = "here are some words";
    my $count = () = $str =~ /\S+/g;
    
  2. or download this
    my $last_operand = ("a", "b", "c");  # "c"
    my $true_or_false = /\w+/g;          # 1 or ""
    my $dunno = some_function();         # who knows?!
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2014-07-12 12:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (239 votes), past polls