Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
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 examining the Monastery: (10)
As of 2014-09-17 18:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (94 votes), past polls