On Wednesday, November 6, 2002, at 10:37  AM, John Delacour wrote:

At 10:34 am +1100 6/11/02, Ken Williams wrote:

#!/usr/bin/perl
$dir = "$ENV{HOME}/Library/Mail";
opendir DIR, $dir ;
for (readdir DIR) {
  /@/ and push @accounts, "$dir/$_\n"
}
$acc =  $accounts[0] ;
print $acc ;
### [EMAIL PROTECTED]
opendir ACC, qq~$acc~ or print "$!\n\n" ;
This line has the exact same problem as your last script did - readdir() returns RELATIVE directory paths, so you need to opendir(ACC, "$dir/$acc").
But $acc is already "$dir/$_", as the comment under the print.. line shows. Anyway, the path works fine in the shell, as my script also demonstrates.
Oh, sorry - I did run your code, but misinterpreted the error message.

The error is actually not related to the '@' (though indeed that should be escaped), it's that you have an extra newline in $acc:

/@/ and push @accounts, "$dir/$_\n"

Change it to this and the script will work:

/@/ and push @accounts, "$dir/$_"

-Ken

Reply via email to