use strict; use warnings; my @input = <DATA>; # Take in the entire file my $count = chomp @input; print "Characters removed: $count\n"; __DATA__ This is some text Each line has a newline That makes 3 total
In general, questions like this can be answered quickly by just creating a mock-up script and playing around.
As side notes, since Perl is case sensitive, CHOMP means something different than chomp, though your intent is obvious enough. As well, note chomp is a function (perlfunc), not an operator (perlop). In particular, chomp is a function with side-effects - it changes the variables you pass it. The difference may explain why you were searching for some special Perl variable (perlvar).
In reply to Re: Chomp Command
by kennethk
in thread Chomp Command
by sarathi.mh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |