List Info

Thread: FIle handler fails




FIle handler fails
user name
2006-11-28 14:50:24
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
merlynstonehenge.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
<jabirahmedyahoo.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 <merlynstonehenge.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/
 
FIle handler fails
user name
2006-11-28 15:13:07
>>>>> "Schelske," == Schelske,
Steve K <skschelskeaaamichigan.com> writes:

Schelske,> Where can I find out more about lexicals?  I
see "my $file" and don't
Schelske,> know what it means.

See the tutorials listed at learn.perl.org.  Buy or borrow
"Learning Perl".

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. -
+1 503 777 0095
<merlynstonehenge.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

<*> 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/
 
FIle handler fails
user name
2006-11-28 15:45:01
To:             	<perl-beginner@yahoogroups.com>
From:           	"Schelske, Steve K."
<skschelskeaaamichigan.com>
Date sent:      	Tue, 28 Nov 2006 09:50:24 -0500
Subject:        	RE: [PBML] FIle handler fails
Send reply to:  	perl-beginner@yahoogroups.com

> Where can I find out more about lexicals?  I see
"my $file" and don't
> know what it means.

Coping with Scoping - by MJD
http://pe
rl.plover.com/FAQs/Namespaces.html

Jenda
===== JendaKrynicky.cz === http://Jenda.Krynicky.cz
=====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
	-- Terry Pratchett in Sourcery



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/
 
[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )