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