Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: 2 basic questions

by karlgoethebier (Vicar)
on Apr 29, 2013 at 14:35 UTC ( #1031220=note: print w/ replies, xml ) Need Help??


in reply to 2 basic questions

Another TIMTOWTDI:

my $result = (split "", "ab")[(length(qq(ab))-1)]; print $result;

Please note: with subtraction ;-)

Update:

Two more...

$result = pop @{ [ split( "", "ab" ) ] }; print qq($result\n); $result = splice( @{ [ split( "", "ab" ) ] }, -1 ); print qq($result\n);

Perhaps this is the reason why some folks hate perl?

Regards, Karl

P.S.:

«The Crux of the Biscuit is the Apostrophe»


Comment on Re: 2 basic questions
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (12)
As of 2015-07-02 18:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (44 votes), past polls