Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Matching against $_ behaves differently than matching against a named scalar?

by nysus (Parson)
on Apr 20, 2020 at 16:04 UTC ( [id://11115834]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    open (my $fh, '<text.txt');
    
    ...
      /^([^ ]+) ([^ ]+)/;
      print "$1 $2" . "\n" if $1 && $2;
    }
    
  2. or download this
    hello one two three
    kjsf
    kjsd
    kjd
    
  3. or download this
    hello one
    hello one
    hello one
    hello one
    
  4. or download this
    while (my $line = <$fh>) {
      $line =~ /^([^ ]+) ([^ ]+)/;
      print "$1 $2" . "\n" if $1 && $2;
    }
    
  5. or download this
    hello one
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-04-18 21:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found