in reply to Re: Total Files
in thread Total Files

If he just wants the number of files, why the array first?
my $nfiles = scalar grep -f, glob("*");

ar0n ]

Replies are listed 'Best First'.
Re: (ar0n) Re (2): Total Files
by petdance (Parson) on Jun 07, 2001 at 23:03 UTC
    If he just wants the number of files, why the array first?

    Because someone who's new enough to not know how to get the number of files in a directory could probably use the benefit of having it spelled out in two distinct steps.

    Not everything in Perl is a matter of golf.

    xoxo,
    Andy

    %_=split/;/,".;;n;u;e;ot;t;her;c; ".   #   Andy Lester
    'Perl ;@; a;a;j;m;er;y;t;p;n;d;s;o;'.  #   http://petdance.com
    "hack";print map delete$_{$_},split//,q<   andy@petdance.com   >
    
      Err, you did say
      Most straightforward approach would be:
      didn't you?

      Not everything in Perl is a matter of golf.
      I couldn't agree more, but there is a difference between 'golf' and being terse.

      ar0n ]