in reply to Stopping empty files from been pushed into an array.

ogbalex:

Sure, just don't push the file onto the array if they're empty:

push @array, $file_name unless length($file_contents) < 1;

Update: Corrected len to length. (Too much Python today at work...)

...roboticus

When your only tool is a hammer, all problems look like your thumb.

Replies are listed 'Best First'.
Re^2: Stopping empty files from been pushed into an array.
by Your Mother (Archbishop) on May 13, 2015 at 20:38 UTC

    What is len()? :P

      Why, it is of course:

      sub len{ return do { local(@ARGV, $/) = $_[0]; <> } =~ y===c; }

      :P

      Disclaimer: use -s $filename. This code is ineficient and ment as a timtoady

      Your Mother:

      len() is a function that gives you the length of things....


      ...in python

      ...roboticus

      When your only tool is a hammer, all problems look like your thumb.