in reply to Total Files

Most straightforward approach would be:
my @filelist = <*>; my $nfiles = scalar @filelist;
You may also want to look into the readdir function.

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   >

Replies are listed 'Best First'.
(ar0n) Re (2): Total Files
by ar0n (Priest) on Jun 07, 2001 at 23:00 UTC
    If he just wants the number of files, why the array first?
    my $nfiles = scalar grep -f, glob("*");

    ar0n ]

      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 ]