-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 4/7/99 12:57 PM, Brenda Cannon bcannon@cmsplatform.com tickled the keyboard to say: >Hi, > >Yes, I'm a newbie. (Not much I can do about it, so I guess I won't >bother apologizing). Anyways, I am having trouble getting the following >to work correctly: > >my ($target_link, @dir_list, $file_type, @movie_list); > > @dir_list = readdir IMAGEDIRECTORY; > > >When I try to access $file_type in the 6th line of code, I get a "use >of uninitialized value" message. I tried printing $file_type and it >appears to be NULL ($target_link has the correct value when I print >it). I'm using the latest version of MacPerl (downloaded yesterday). >What am I missing here? This may not be all of it, but it certainly is part of it: your if statement is _outside_ your foreach loop; this leads to a problem that the $file_type variable is reassigned each time through the loop and comes out with just the last value. Second, you're push the file type on your movie list, not the file name which is in $target_link, which is what I think you want to do (otherwise you end up with a list of {"MooV", "MooV", ... }). I think you want something more like this: foreach $target_link (@dir_list) { $file_type = MacPerl::GetFileInfo($target_link); if ($file_type eq "MooV") { push @movie_list, $target_link; } } - --Paul -----BEGIN PGP SIGNATURE----- Version: PGP 6.0.2 iQA/AwUBNwuKB29ORSfn1gnaEQILhgCgti8N6SVZkG9Jx/linzykfsyH4uMAnjcr zxMl5HXqtNy2VYUcrfwjxGxv =7U1K -----END PGP SIGNATURE----- ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org