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

Re^2: Iterate string like, for(1..5) i.e. $stirng="1..5"; for($string)

by gman (Friar)
on Oct 09, 2005 at 21:19 UTC ( [id://498667]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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 09, 2005 at 21: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!!!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://498667]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.