in reply to Get file min and max size help!

Try adding parenthesis, as indicated by the error message. I've not tried it, but I'd suggest starting with:

push @files , grep { -f && (-s >= $min_size) && (-s <= $max_size) +} map { "$d/$_" } read_dir ($d);

Note: I've added the map bit, as it looks like that's what you were wanting.

...roboticus

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

Replies are listed 'Best First'.
Re^2: Get file min and max size help!
by Anonymous Monk on Aug 29, 2011 at 14:33 UTC
    Still getting the same issue message:
    Warning: Use of "-s" without parentheses is ambiguous at test.pl line 19. Unterminated <> operator at test.pl line 19.

      Never mind ... apparently today I'm an idiot...

      Reading the documentation reveals that -s doesn't return a number. Instead, it indicates whether has nonzero size. If you need to know the file size, you'll have to use a suitable function to read the file size, and *then* compare it.

      ...roboticus

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

        Actually it does, at least according to perlfunc and to my experience:

        -s File has nonzero size (returns size in bytes).