removes any trailing string that corresponds to the current value of $/
Maybe this is problem due to my poor english but with 'any' i supposed to be 'all accurences' not the last one.
$ perl -MData::Dumper -e ' $g=$f=qq{a\n}; print Dumper( chomp( $f, $g
+ ) ) ; print Dumper( $f, $g )'
$VAR1 = 2;
$VAR1 = 'a';
$VAR2 = 'a';
$perl -MData::Dumper -e ' $g=$f=qq{a\n\n}; print Dumper( chomp( $f, $
+g ) ) ; print Dumper( $f, $g )'
$VAR1 = 2;
$VAR1 = 'a
';
$VAR2 = 'a
';
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
| [reply] [d/l] |
removes any trailing string that corresponds to the current value of $/ Maybe this is problem due to my poor english but with 'any' i supposed to be 'all accurences' not the last one.
ok, I see where you're coming from :) this is one of the deals with documentation as free form prose ... its free form prose :)
The current value of $/ is "\n" it is not "\n\n", does that make sense to you? with a valid $/ chomp only chomps once
Consider this as chomp documentation :) 2,4,4,0,0 :)
use Data::Dump qw/ dd /;
$f = $g = "a\n\n"; dd( chomp( $f, $g ) ); dd( $f, $g );
$/ = "\n\n"; $f = $g = "a\n\n"; dd( chomp( $f, $g ) ); dd( $f, $g );
$/ = ""; $f = $g = "a\n\n"; dd( chomp( $f, $g ) ); dd( $f, $g );
$/ = undef; $f = $g = "a\n\n"; dd( chomp( $f, $g ) ); dd( $f, $g );
$/ = \333; $f = $g = "a\n\n"; dd( chomp( $f, $g ) ); dd( $f, $g );
__END__
2
("a\n", "a\n")
4
("a", "a")
4
("a", "a")
0
("a\n\n", "a\n\n")
0
("a\n\n", "a\n\n")
| [reply] [d/l] |
| [reply] [d/l] |