Try this instead:
my $found; while ( my $file = readdir(DIR) ){ $found = $file, last if $file=~/^myname\.doc$/i; } closedir(DIR); print "Found: $found" if $found;
In reply to Re: Passing value outside of loop
by FamousLongAgo
in thread Passing value outside of loop
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |