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")
In reply to Re^4: Assigning the result of a chomp to the chomped var itself.
by Anonymous Monk
in thread Assigning the result of a chomp to the chomped var itself.
by choroba
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |