in reply to Read first line from each file in a directory
Backslash characters are not what you think they are in double-quoted strings. You probably just want to open using Unix/Linux style, which is recognized by windows, or you should use File::Spec.
open DIR, "/mail";
or maybe even use glob (). I have no idea how well that works on Windows
foreach my $f (glob ("/mail/*.*")) { open my $fh, "<", $f; print scalar <$fh>; }
|
|---|