in reply to Re: Iterate string like, for(1..5) i.e. $stirng="1..5"; for($string)
in thread Iterate string like, for(1..5) i.e. $stirng="1..5"; for($string)

I would like my output to be the same using as
explecit for(1..5) or a string in it's place for($string)
where $string = "1..5";
Thanks
  • Comment on Re^2: Iterate string like, for(1..5) i.e. $stirng="1..5"; for($string)

Replies are listed 'Best First'.
Re^3: Iterate string like, for(1..5) i.e. $stirng="1..5"; for($string)
by GrandFather (Saint) on Oct 10, 2005 at 01:24 UTC

    Do you want something like:

    my $range = "2..5,10..15"; my @ranges = eval "($range)";

    Perl is Huffman encoded by design.
      Exactly!!!!
      Thanks! Should I have looked in the docs about eval?

      Thanks again!!!