Re: 1 doubt.
Le jeu 11/12/2003 à 10:27, Ajey Kulkarni a écrit : perl t.pl Name main::FH used only once: possible typo at t.pl line 6. cat t.pl #!/usr/bin/perl use strict; use warnings; open FH, out.dat; Why am i getting this warning? When i remove the warnings,this goes off? Is there any problem if i not include use warnings line? This is just a warning saying that you are using FH only once (well, it's written so). Indeed, why would you need to open the file if you are not writing or reading or accessing it anyway? Just, for example, close it using close FH; unless you wanna do something special with that? Yannick -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
1 doubt.
perl t.pl Name main::FH used only once: possible typo at t.pl line 6. cat t.pl #!/usr/bin/perl use strict; use warnings; open FH, out.dat; Why am i getting this warning? When i remove the warnings,this goes off? Is there any problem if i not include use warnings line? Quick reply is highly appreciated regards -Ajey -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: 1 doubt.
Name main::FH used only once: possible typo at t.pl line 6. It's because it's used only once ;o) . If you just declare something (variable, filehandle etc.) but don't use it, something's probably wrong with your code (such as a typo). If you try reading or writing using that filehandle the error will go away. This email has been scanned for all viruses by the MessageLabs Email Security System. For more information on a proactive email security service working around the clock, around the globe, visit http://www.messagelabs.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: 1 doubt.
On Dec 11, 2003, at 3:27 AM, Ajey Kulkarni wrote: perl t.pl Name main::FH used only once: possible typo at t.pl line 6. cat t.pl #!/usr/bin/perl use strict; use warnings; open FH, out.dat; Why am i getting this warning? When i remove the warnings,this goes off? Is there any problem if i not include use warnings line? As the warning say, you used FH only once. You open() a file and do nothing with it. Perl's just making sure you are aware of the issue. Once you start using the file Perl will be quite about it. While you're at it, don't forget to check that the file opened properly: open FH, 'out.dat' or die File error: $!\n; James -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: 1 doubt.
On Thu, Dec 11, 2003 at 09:27:48AM +, Ajey Kulkarni wrote: perl t.pl Name main::FH used only once: possible typo at t.pl line 6. You opened a file, but you do not read from the file. Just opened it. This doesn't make much sense. So you get a warning. cat t.pl #!/usr/bin/perl use strict; use warnings; open FH, out.dat; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: 1 doubt.
It's a warning. If you turn it off you wont get it :) Ned Cunningham POS Systems Development Monro Muffler Brake 200 Holleder Parkway Rochester, NY 14615 (585) 647-6400 ext. 310 [EMAIL PROTECTED] -Original Message- From: Ajey Kulkarni [mailto:[EMAIL PROTECTED] Sent: Thursday, December 11, 2003 4:28 AM To: [EMAIL PROTECTED] Subject:1 doubt. perl t.pl Name main::FH used only once: possible typo at t.pl line 6. cat t.pl #!/usr/bin/perl use strict; use warnings; open FH, out.dat; Why am i getting this warning? When i remove the warnings,this goes off? Is there any problem if i not include use warnings line? Quick reply is highly appreciated regards -Ajey -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: 1 doubt.
Ajey Kulkarni wrote: perl t.pl Name main::FH used only once: possible typo at t.pl line 6. cat t.pl #!/usr/bin/perl use strict; use warnings; open FH, out.dat; Why am i getting this warning? Because the compiler thinks that you are probably doing something pointless. You are loading a filehandle, but never accessing it. Since it can't see why you would be creating a filehandle without using it, iot guesses that you may have mistyped some other name. When i remove the warnings,this goes off? Is there any problem if i not include use warnings line? Better to either do something with the filehandle, or get rid of it. Don't shoot the messenger. Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response