At 03:27 PM 6/28/01 -0500, you wrote:
>All,
>I wish to remove trailing spaces..
>
>#!/usr/bin/perl -w
>use strict ;
>my $line  ;
>while (<>)  {
>chomp $_ ;
>$line =~ s/\s+$//; #  remove trailing spaces
>print " $line \n";
>}
>
>My output is equal number of blank lines..
>
>Where is my error?
>
>Frank

You haven't initialized $line.  You should either use $_ as the variable on 
which you perform the regex and then print, or set $line = $_ or
while ($line = <>)

hth


Peter Cline
Inet Developer
New York Times Digital

Reply via email to