Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

getfile( $filename )

by harleypig (Monk)
on Jul 29, 2005 at 01:03 UTC ( [id://479199]=CUFP: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub getfile {
      my $filename = shift;
      open my $FH, "<$filename" or die "Unable to open $filename: $!";
      return wantarray ? map /(.*)/, <$FH> : do { local $/ ; <$FH> };
    }
    
  2. or download this
    sub getfile { local *ARGV ; @ARGV = shift ; wantarray ? map /(.*)/, <>
    + : do { local $/ ; <> } }
    
  3. or download this
    sub getfile {
      my $filename = shift;
    ...
    
      return wantarray ? split m{$/}, $contents : $contents;
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: CUFP [id://479199]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2024-04-23 09:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found