in reply to foreach (each character in string..)?

OK, since I was late with my legit response, here's a stupid way:
my @list; my $string = "hi there"; while($string) { push @list, chop($string); } foreach(reverse(@list)) { print "$_\n"; }

Replies are listed 'Best First'.
Re: Re: foreach (each character in string..)?
by boo_radley (Parson) on Jan 20, 2004 at 17:57 UTC

    make it smart-stupid with unshift.
    really not adding anything,
    boo

      To be honest, I'm amazed no one has bitched because it fails if you hand it the string '0', but thanks anyway :)