Re: In search of elegant code: inverting a string

From: Roy Johnson (rjohnson_at_shell.com)
Date: 10/30/03


Date: 30 Oct 2003 06:47:08 -0800

yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones) wrote in message news:<3fa05ae9@news.victoria.tc.ca>...
> I am guessing you tried
> print reverse 'ABCDEFG' ;
> unfortunately that would be misleading. Instead you must type
> print scalar reverse 'ABCDEFG';
> or
> $reversed = reverse 'ABCDEFG';
> print $reversed;

or
   print my $reversed=reverse 'ABCDEFG';
or even
   print ''.reverse 'ABCDEFG';

or, to avoid reverse (for whatever reason):
   $foo='ABCDEFG';
   print map(substr($foo,-$_,1), 1..length $foo)



Relevant Pages

  • Re: I love IP Tables.... (really sshd attacks)
    ... dictionary attack. ... Guessing an RSA 1k passowrd by trying each should ... at least belt and suspenders, key and password, access. ... And as I say, even guessing "abcdefg" ...
    (Fedora)
  • Re: JVC
    ... Sorry my satire was so misleading for you. ... I'm sure JVC works fine for ... your tastes, considering the source i'm guessing they are the best ...
    (rec.audio.car)
  • Re: Is 2003 R2 a free upgrade?
    ... I'm guessing "no" but I'd like that confirmed. ... One of Microsoft's more misleading releases... ... Hank Arnold ... Windows Server - Directory Services ...
    (microsoft.public.windows.server.general)
  • Re: Where is my mistake sudoku
    ... Yeah I figured that out now. ... The instructions said you could solve the puzzle without guessing. ... was a little misleading to me then. ...
    (rec.puzzles)