in reply to Re^3: Assigning the result of a chomp to the chomped var itself.
in thread Assigning the result of a chomp to the chomped var itself.

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")

Replies are listed 'Best First'.
Re^5: Assigning the result of a chomp to the chomped var itself.
by Discipulus (Canon) on Nov 26, 2014 at 19:37 UTC
    what a docs!
    well i suggest anonymous monk as responsable of a parallel, non-prosed documentation for all Perl functions..
    you agree? ;=)

    L*
    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.