Where can I find out more about lexicals? I see "my
$file" and don't
know what it means.
Thanks.
-----Original Message-----
From: perl-beginner@yahoogroups.com
[mailto:perl-beginner@yahoogroups.com] On Behalf Of
merlyn stonehenge.com
Sent: Tuesday, November 28, 2006 9:45 AM
To: Jabir Ahmed
Cc: perl-beginner@yahoogroups.com
Subject: Re: [PBML] FIle handler fails
>>>>> "Jabir" == Jabir Ahmed
<jabirahmed yahoo.com> writes:
Jabir> eg:
Jabir> sub writeFile{
Jabir> $file=shift;
Jabir> $string=shift;
Jabir> open (FH,">$file");
Where's your error checking?
At a minimum, always write these as:
open FH, ">$file" or die "Cannot
create: $!";
until you want to do something other than die.
Jabir> print FH $string;
Jabir> close (FH);
Jabir> }
Also, $file and $string should be lexicals (my $file, etc).
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. -
+1 503 777
0095 <merlyn stonehenge.com> <URL:http://www.ston
ehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy,
etc. etc. See
PerlTraining.Stonehenge.com for onsite and open-enrollment
Perl
training!
Unsubscribing info is here:
h
ttp://help.yahoo.com/help/us/groups/groups-32.html
Yahoo! Groups Links
Unsubscribing info is here: h
ttp://help.yahoo.com/help/us/groups/groups-32.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://g
roups.yahoo.com/group/perl-beginner/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http
://groups.yahoo.com/group/perl-beginner/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:perl-beginner-digest@yahoogroups.com
mailto:perl-beginner-fullfeatured@yahoogroups.com
<*> To unsubscribe from this group, send an email to:
perl-beginner-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.c
om/info/terms/
|