[Israel.pm] how do i cut the first 2 characters/digits of a string?

Mikhael Goikhman migo at homemail.com
Thu Jul 15 07:32:23 PDT 2004


On 15 Jul 2004 13:58:51 +0300, Gaal Yahas wrote:
> 
> This is no longer as fast, but at least does the job:
> 
>      chop($_ = reverse); chop; $_ = reverse

The following should be more consistent and clear:

	$_ = reverse; chop; chop; $_ = reverse

And this one is probably both shortest and fastest:

	s/^..//s;


Here is the riddle. What do you think the following does:

	$_ = reverse, chop, chop;

Give an aproximate answer and then verify it by running.
And now that you know what "$_ = reverse, chop, chop;" does, this one:

	$_ = reverse $_ = reverse, chop, chop;

Give an aproximate answer and then verify it by running.
I bet most of the camels will not be able to answer correctly here. :)

Regards,
Mikhael.

-- 
perl -e 'print+chr(64+hex)for+split//,d9b815c07f9b8d1e'



More information about the Perl mailing list