$dir="C:\\Windows\\Desktop\\Perl\\scriptz\\miei\\opendir\\1\\"; opendir DIR, $dir or die "no $dir?: $!"; foreach $name (sort readdir(DIR)) { # skip anything that is not a file ie . .. and other dirs next unless -f $dir.$name; print "$dir$name\n"; open FU, $dir.$name or die "can't open $dir.$name :$!"; my @contfile=; $url=substr($contfile[1],8,); print "$url\n"; close FU or die "$!"; } #### my $line; my $line_you_want = 2; $line = for 1..$line_you_want; # $line will now contain just the content of line number $line_you_want;