Michael Gale wrote:
Hello,
Hello,
I have the following piece of code:
--snip--
if ($_ eq "read") {
open(fileid, "/tmp/mysql_lastid") || $lastid=0;
$lastid = <fileid>;
close(fileid);
}
--snip--
With the fail of opening the file, I want the variable to be set to zero
and print a message to standard out. How can I do both ?
open fileid, '/tmp/mysql_lastid' or do { $lastid = 0; print STDOUT
"message\n" };
Or:
unless ( open fileid, '/tmp/mysql_lastid' ) {
$lastid = 0;
print STDOUT "message\n";
}
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>