in reply to Re: String Length
in thread String Length

As long as you're doing that, why not grab both the number and the suffix? It's not critical for this example, but as long as we're being picky...
my $day = '1ST'; my $suffix = substr($day, -2, 2, ''); print $day; # "1" print $suffix; # "ST"
buckaduck

Replies are listed 'Best First'.
Re: Re: Re: String Length
by cLive ;-) (Prior) on Apr 05, 2001 at 01:12 UTC
    Why declare a variable just because we can? if it's not needed, there's no point...

    Also, $day is still "1ST", not "1" as you have not amended it.

    cLive ;-)

        oops :)

        But, errrr, why doesn't The Camel (2nd edition) mention this? under the function?

        cLive ;-)

        Update (comment on below) - damn you merlyn, you mean I gotta get a new camel now? Pwththththth!

        Oh well. Of course, I suppose I could start reading the man pages for once... :)