Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
i am opening a file as
open($fo,"<", $ggg)
and if file does not exist I wish to display a message and exit only when he presses q
so I did this
{ "\n\n$ggg is missing:\nensure that this file is in the working +dir.\nWe are exiting \n\n"; print "Please press q to quit \n"; my $fi = <STDIN>; chomp $fi; if ($fi eq "q" ||$fi eq "Q") { exit; } else { while ($fi) { print "Please press q to quit \n"; $fi = <STDIN>; chomp $fi; if ($fi eq "q" ||$fi eq "Q") { exit() } }
the code is working so that is not the issue , just I wish to know how to give that else statement , i.e. if file does not exist the above code should be executed
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: file dies instantly
by rjt (Curate) on Jul 24, 2013 at 13:14 UTC | |
|
Re: file dies instantly
by choroba (Cardinal) on Jul 24, 2013 at 13:16 UTC | |
|
Re: file dies instantly
by kcott (Archbishop) on Jul 24, 2013 at 13:21 UTC | |
by Eily (Monsignor) on Jul 24, 2013 at 14:25 UTC |