Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Error "Use of uninitialized value $lines[0] in substitution (s///) at " with below Code

by Anonymous Monk
on Dec 11, 2014 at 21:00 UTC ( [id://1110101]=note: print w/replies, xml ) Need Help??


in reply to Error "Use of uninitialized value $lines[0] in substitution (s///) at " with below Code

readdir returns such files as '.' and '..'
opendir my $dir, './var'; say join "\n", readdir $dir;
Output:
fonts.tar.gz . c ..
Reading this stuff yields nothing:
open my $file, '<', '.'; my @lines = <$file>; say join "\n", @lines; say scalar @lines;
Produces empty line and 0.

Use glob instead...

  • Comment on Re: Error "Use of uninitialized value $lines[0] in substitution (s///) at " with below Code
  • Select or Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-04-25 07:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found