Re: Reading from a filehandle in while-loop
Bastian Angerstein wrote: Why does this dont work in my Script? open (TEST, /tmp/test.txt); while (TEST) { print $_; # or just print; } Does the file exists and can you read it? -- Flemming Greve SkovengaardThe killer's breed or the Demon's seed, a.k.a Greven, TuxPowerThe glamour, the fortune, the pain, [EMAIL PROTECTED] Go to war again, blood is freedom's stain, 4112.38 BogoMIPS Don't you pray for my soul anymore. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Reading from a filehandle in while-loop
Bastian Angerstein wrote: Joop, if I use open... or die $! i see that the file is opened correctly but nothing is in $_. -Ursprngliche Nachricht- Von: Flemming Greve Skovengaard [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 26. Oktober 2004 11:45 An: [EMAIL PROTECTED] Cc: Bastian Angerstein Betreff: Re: Reading from a filehandle in while-loop Bastian Angerstein wrote: Why does this dont work in my Script? open (TEST, /tmp/test.txt); while (TEST) { print $_; # or just print; } Does the file exists and can you read it? Bottompost, please. Your script works on my machine. Is this you whole script, do you use: use strict; use warnings; in your script and is there any content in /tmp/test.txt? -- Flemming Greve SkovengaardThe killer's breed or the Demon's seed, a.k.a Greven, TuxPowerThe glamour, the fortune, the pain, [EMAIL PROTECTED] Go to war again, blood is freedom's stain, 4112.38 BogoMIPS Don't you pray for my soul anymore. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Reading from a filehandle in while-loop
Bastian Angerstein wrote: I noticed that while ($test=TEST) works on my system perfectly but while (TEST) dont ... dont know why... should reinstall perl. Thanks for your help Bastian They should both work, why they don't is beyond me. Please post on the list, I am *not* a all-seeing, all-knowing Perl guru, you know, while I can't answer why one work and the other doesn't someone else on the list might. And again, please bottompost. -- Flemming Greve Skovengaard FAITH, n. a.k.a Greven, TuxPower Belief without evidence in what is told [EMAIL PROTECTED] by one who speaks without knowledge, 4112.38 BogoMIPS of things without parallel. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Reading from a filehandle in while-loop
On Tue, 26 Oct 2004 11:33:24 +0200, Bastian Angerstein [EMAIL PROTECTED] wrote: Why does this donĀ“t work in my Script? open (TEST, /tmp/test.txt); while (TEST) { print $_; # or just print; } You are making the assumption that 'TEST' sets '$_' which is not true. Oddly, perl makes '' set $_, but not FILE... dunno why consider while( $_ = TEST ) { } -- 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: Reading from a filehandle in while-loop
David le Blanc wrote: ... You are making the assumption that 'TEST' sets '$_' which is not true. Oddly, perl makes '' set $_, but not FILE... dunno why Sorry, but that's just not correct. while (TEST) DOES set $_, as documented in perldoc perlop under the secion I/O Operators The OP has some other problem. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Reading from a filehandle in while-loop
David == David le Blanc [EMAIL PROTECTED] writes: David You are making the assumption that 'TEST' sets '$_' which is not David true. Oddly, perl makes '' set $_, but not FILE... dunno why No, that's completely wrong. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response