incorrect!
chomp $word;
not
$word =~ chomp $word ;
> -----Original Message-----
> From: Bellenger, Bruno (Paris) [SMTP:[EMAIL PROTECTED]]
> Sent: 15/03/2001 12:29
> To: [EMAIL PROTECTED]
> Subject: RE: Beginner's problems
>
>
> To stay closer to your code, this works :
>
> open(IN, "words.txt");
> while(<IN>){
> $word = $_ ;
> $word =~ chomp $word ;
> print "$word and $word\n";
> }
>
>
> The way you did it assigned chomp's return code to $word,
> not the content of $_
>
> To avoid this, you must write
>
> $word =~ chomp $word ;
> and not
> $word = chomp $word ;
>
>
> _____________________________________________
> Bruno Bellenger
> Sr. Network/Systems Administrator
>
> -----Original Message-----
> From: BP Jonsson [SMTP:[EMAIL PROTECTED]]
> Sent: mercredi 14 mars 2001 14:03
> To: [EMAIL PROTECTED]
> Subject: Beginner's problems
>
> Hi,
>
> I'm a Perl beginner who has problems with things that according to
> the
> literature should be quite straightforward. Suppose that I have
> this program:
>
> open(IN, "words.txt");
> while(<IN>){
> $word = chomp;
> print "$word and $word\n";
> }
>
> If I the file "words.txt" contains the three lines
> fred
> barney
> dino
> then this program should print out
> fred and fred
> barney and barney
> dino and dino
>
> But all I get is a single digit "1"!
>
> WTH is going on?
>
> TIA,
>
> /BP 8^)>
> --
> B.Philip Jonsson mailto:[EMAIL PROTECTED] (delete X)
>
>
> _______________________________________________
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users