Richard Lee wrote:
Gunnar Hjalmarsson wrote:
Gowri Chandra Sekhar Barla, TLS, Chennai wrote:
I have a file in which 10 lines are there each line is of with different
sizes
I want to print these lines in another files
If size of line is greater than 80 I should break the line

    while (<>) {
        chomp;
        while ( my $line = substr $_, 0, 80, '' ) {
            print "$line\n";
        }
    }

works fine,

<snip>

But what is the extra syntax at the end for substr?   ' '  ???

I thought substr was sbustr($var, $offset, $count)    ???

The '' argument makes substr() remove the substring from $_. Please read about the 4-arg version of substr() in "perldoc -f substr".

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to