user-pic

flymike

  • About: Keep it simple, stupid.
Subscribe to feed Recent Actions from flymike

  • gautam.dey77 commented on A simple perl recursion example

    So, you solution would eventually run out of memory; or would hit the limit of number of processes your os will allow. If you really want it to be infinite; you should use exec; which would basically be doing a tail call optimization. (Since nothing after the exec will get called; and the process memory space is reused.)



    #!/usr/bin/perl

    use v5.12.0;
    use warnings;

    say 'foo:'.($ARGV[0] // 'none');
    exec join(' ' ,$^X, $0 , $ARGV[0]+1) ;


Subscribe to feed Responses to Comments from flymike

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.