Edmond Rodriguez on 25 Jun 2009 09:57:31 -0700 |
If you put in two files that don't exist you get two error messages. If you put in one file that does not exist followed by one that does, it still processes the one that does exist. Is it designed to be fail safe for this invocation? $ ./example.pl foo foo2 Can't open foo: No such file or directory at ./example.pl line 3. this is foo line 1this is foo line 2 $ echo $? 0 ----- Original Message ---- > From: Mark M. Hoffman <mhoffman@lightlink.com> > To: plug@lists.phillylinux.org > Sent: Thursday, June 25, 2009 12:24:20 PM > Subject: [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 ___________________________________________________________________________ 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
|
|