in reply to Remove newline character from start of string

Yet another way to do it:
chomp($string); my $rev = reverse($string); chomp($rev); $string = reverse($rev);
Note: Coded Before Coffee; no warranties, no promises.

----
I Go Back to Sleep, Now.

OGB

Replies are listed 'Best First'.
Re^2: Remove newline character from start of string
by danj35 (Sexton) on May 10, 2010 at 13:19 UTC

    I like this. Nice and simple. Although thanks to everyone else for providing alternative solutions that also work. Monks rule once more :)

Re^2: Remove newline character from start of string
by afoken (Chancellor) on May 11, 2010 at 05:21 UTC

    Nice, but that works only if $/ eq reverse($/). Otherwise, you also need local $/=reverse $/ before chomp($rev).

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)