#Start test.pl
use strict;

# test.pl is saved in c:/work/temp
my $testDir = "c:/work/temp";

   opendir(DIR, $testDir );
      my $file = grep { /st.pl$/ } readdir(DIR);
   closedir(DIR);

   print "blah1: [[[" .  $file ."]]]\n" ;
   print "blah2: [[[" .  "$file" ."]]]\n" ;
   
   opendir(DIR, $testDir );
      my @file = grep { /st.pl$/ } readdir(DIR);
   closedir(DIR);

   print "blah3: [[[" .  @file ."]]]\n" ;
   print "blah4: [[[" .  "@file" ."]]]\n" ;
#End test.pl


The result ends up being:

C:\>perl c:\work\temp\test.pl
blah1: [[[1]]]
blah2: [[[1]]]
blah3: [[[1]]]
blah4: [[[test.pl]]]

Could any one explain why I am getting the different results. I would
thought that I would get the file name back in all instances of blah not
just blah4 and why does it only work when @file is surrounded by quotes.

WinXP - Pro
Perl - v5.8.6 built for MSWin32-x86-multi-thread


Cheers Roman











-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to