Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
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 romping around the Monastery: (7)
As of 2014-11-28 13:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (197 votes), past polls