Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Perl Idioms Explained - @ary = $str =~ m/(stuff)/g

by tachyon (Chancellor)
on Sep 15, 2003 at 12:53 UTC ( [id://291543]=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    @ary = $str =~ m/(stuff)/g;
    
  2. or download this
    ($scalar) = $str =~ m/(this)/;
    
  3. or download this
    $str =~ m/(stuff)/;
    print $1
    
  4. or download this
    @all_the_matches   = $str =~ m/(stuff)/g;
    
  5. or download this
    @links = $html =~ m/<a[^>]+href\s*=\s*["']?([^"'> ]+)/ig;
    
  6. or download this
    <A CLASS="blah" HREF="foo.com">
    
  7. or download this
    $data = '
    f1 f2 f3
    ...
    
    @second = $data =~ m/^\S+\s+(\S+)/mg;
    print "@second";
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://291543]
Approved by broquaint
Front-paged by MrCromeDome
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-19 10:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found