In order to use the array @files in the below code outside of the subroutine, so I need to declare @files globally? I'm getting errors at the moment: Global symbol "@files" requires explicit package name
If so, where is the correct place to declare them in terms of neatness? At the start of the program? above the subroutine? Thanks. #!/usr/bin/perl use strict; use warnings; #use Image::Magick::Thumbnail; # set directory to read images from my $dir = "/ged/code/photo/vx"; # read all files from given directory opendir DH, $dir or die "Cannot open $dir: $!"; foreach my $file (readdir DH) { unless ($file =~ /^\./) { push my(@files), $file; } } closedir DH; #check files are in the array print $_ foreach @files; ************************************************************************ The information contained in this message or any of its attachments is confidential and is intended for the exclusive use of the addressee. The information may also be legally privileged. The views expressed may not be company policy, but the personal views of the originator. If you are not the addressee, any disclosure, reproduction, distribution or other dissemination or use of this communication is strictly prohibited. If you have received this message in error, please contact [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> and then delete this message. Exide Technologies is an industrial and transportation battery producer and recycler with operations in 89 countries. Further information can be found at www.exide.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>