flymike
- About: Keep it simple, stupid.
Recent Actions
-
Commented on A simple perl recursion example
Your script is better, which need no concern for name or directory. Thanks....
-
Posted A simple perl recursion example to flymike
Have a test about what will happen if a script is calling to run it self when it is running:
#!/usr/bin/perl use strict; use warnings; print "******\n"; perl $0;
The result will be kind of infinite recursion, keep printing out the *
-
Commented on Most common build-in functions or operators beginners should know about Perl
Thanks for the kind reminder. have added it....
-
Commented on What does "my" really mean?
Sorry for missing the source link. have added it. BTW, your perl tutorials are very great. Thanks for sharing. XD....
-
Commented on Most common build-in functions or operators beginners should know about Perl
yep, you're right, it could be misunderstanding, although the results are the same. have edited it.Thanks....
-
Posted Most common build-in functions or operators beginners should know about Perl to flymike
if (defined $x)
check a value or variable is undef or not.
undef $x;
reset a variable to undef.
qq, double-q operator; q, single-q operator
print qq(The "…
-
Posted What does "my" really mean? to flymike
"The meaning of my $x is that you tell perl, and specifically to strict, that you would like to use a private variable called $x in the current scope. Without this, perl will look for a declaration in the upper scopes and if it cannot find a declaration anywhere it will give a compile-time error…
-
Posted Perl confusing examples to flymike
use warnings; use strict; use 5.010;
print 'OK'; my $x; say $x; $x = 42; say $x;
This code prints statements before the line generating the warning, the result might be confusing:
Use of uniniti…
-
Posted Debuging method for perl Complex data structures to flymike
For complex data structures (references, arrays and hashes) you can use the
use Data::Dumper qw(Dumper); print Dumper \@an_array; print Dumper \%a_hash; print Dumper $a_reference;
These will print something like this, which helps…
-
Posted Hello Perl World to flymike
I will record the fun and valued things during my advanture of perl learning.
Comment Threads
-
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/perluse v5.12.0;
use warnings;say 'foo:'.($ARGV[0] // 'none');
exec join(' ' ,$^X, $0 , $ARGV[0]+1) ;
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.