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 $_;
>> }

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

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

	$ echo $?

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

Philadelphia Linux Users Group         --
Announcements -
General Discussion  --