Re: AW: Reading from a filehandle in while-loop

2004-10-27 Thread Chasecreek Systemhouse
On Wed, 27 Oct 2004 10:43:46 +0200, Bastian Angerstein
<[EMAIL PROTECTED]> wrote:
> Yes it should, but not on my system.
> 
> Thanks for your comments.
> 

So, you are saying this doesnt work?

#!/usr/bin/perl -w

use strict;
use warnings;
use diagnostics;

open (TEST,"STDIN") or die "cannot read input file.";

while() {

  s/\W//g;  # Clean out non-Alphanumeric...

  my $input = ' ';
  $input = $_ if length;

  # Do other things with $input...
  print "Seen $input\n";
}

__END__

???

-- 
WC -Sx- Jones
http://youve-reached-the.endoftheinternet.org/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




AW: Reading from a filehandle in while-loop

2004-10-27 Thread Bastian Angerstein
Yes it should, but not on my system.

Thanks for your comments.

-Ursprüngliche Nachricht-
Von: Bob Showalter [mailto:[EMAIL PROTECTED]
Gesendet: Dienstag, 26. Oktober 2004 16:00
An: 'David le Blanc'
Cc: [EMAIL PROTECTED]
Betreff: RE: Reading from a filehandle in while-loop


David le Blanc wrote:
...
> You are making the assumption that  '' sets '$_' which is not
> true.  Oddly, perl makes '<>' set $_, but not ... dunno why

Sorry, but that's just not correct.

   while ()

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]
 




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




AW: Reading from a filehandle in while-loop

2004-10-26 Thread Bastian Angerstein
Joop,
if I use open... or die "$!" i see that the file is opened correctly but nothing is in 
$_.




-UrsprÃngliche 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 donÂt work in my Script?
> 
> open (TEST, " while () {
>   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]