Takushi Usami wrote:
> I would like to detect an open error when using an anonymous handle
> by designating the undefined scalar variable to open function.
> open(my $fh, "non-exist-file");
You can use the return value of open and the value of the error variables $! 
or $^E just as you normally would. See perldoc -f open and perldoc perlvar. 
FOr example:


C:\>perl -e "open my $file, '<', 'no such thingy' or die qq|Open: $^E\n|"
Open: The system cannot find the file specified

-- 
With kind regards Veli-Pekka Tätilä ([EMAIL PROTECTED])
Accessibility, game music, synthesizers and programming:
http://www.student.oulu.fi/~vtatila/ 

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to