Mark M. Hoffman on 25 Jun 2009 09:24:32 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PLUG] question re: perl diamond operator


Hi all:

Given the following trivial script:

>> #! /usr/bin/perl -w
>> 
>> while (<>) {
>> 	chomp;
>> 	print $_;
>> }

	$ ./example.pl foo
	Can't open foo: No such file or directory at ./example.pl line 3.

So far so good; the file foo really does not exist.

	$ echo $?
	0

Really?  I want the exit status to be non-zero here.  I've looked through the
perl documentation; I can't see any way to get the diamond operator to do what
I want in this case.  I would appreciate any suggestions from perl experts.

Thanks & regards,

-- 
Mark M. Hoffman
mhoffman@lightlink.com

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug