in reply to cut of first char of a string

Is there any kind of sanity check to pass? If not...

# One way... $s = join '', ( split //, $s )[ 1 .. length($s) - 1 ]; print $s, $/;

Update: And another.....

$s = pack 'A*', unpack( 'xA*', $s ); # ASCII only, please ;) print $s, $/;

Dave

Replies are listed 'Best First'.
Re^2: cut of first char of a string
by bart (Canon) on Mar 08, 2005 at 10:00 UTC
    $s = pack 'A*', unpack( 'xA*', $s ); # ASCII only, please ;)
    I see no reason for the pack. And you're better of using 'a*' not 'A*', unless you really want to trim trailing spaces.
    $s = unpack 'xa*', "qwerty "; print "'$s'\n";