Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: howto strip the first char of a string?

by Aristotle (Chancellor)
on Sep 08, 2004 at 22:03 UTC ( [id://389491]=note: print w/replies, xml ) Need Help??


in reply to howto strip the first char of a string?

s/^.//;

What if the first character is a newline? :-) Don't forget the /s! As an aside, FWIW, the s/// is much less efficient than the substr solution here.

Another overengineered way:

use Fcntl qw( :seek ); $_ = "12345"; { open my $fh, "<", \$_; seek $fh, 1, SEEK_SET; local $/; $_ = <$fh>; }

Makeshifts last the longest.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://389491]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (10)
As of 2024-04-19 09:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found