@blah = qw(foo bar baz); open(IN,"/some/file") || die "Cant access file!\nReason: $!\n"; # now we want data out of predefined data $data1 = $blah[0]; $line1 = ; # Directory access is slightly different, but basically the # same.. here is a quick script which is basically the same # as ls /some/dir opendir(DIR,"/some/dir") || die "Cant open dir!\nReason: $!\n"; # instead of using on dirs we use readdir(FH) foreach $file (readdir(DIR)) { chomp($file); print "$file\n"; } closedir(DIR);