Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
szabgab committed Nov 7, 2024
1 parent f914e96 commit f4256d2
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 3 deletions.
62 changes: 61 additions & 1 deletion sites/en/pages/shift.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
=status show
=books beginner
=author szabgab
=comments_disqus_enable 1
=comments_disqus_enable 0

=abstract start

Expand Down Expand Up @@ -56,3 +56,63 @@ Regardless if the array was explicitely given to it or implicely selected based
See <a href="https://perlmaven.com/beginner-perl-maven-shift-and-unshift">video explaining shift and unshift</a>
or the example <a href="https://perlmaven.com/beginner-perl-maven-shift">using shift to get first parameter of a script</a>.

<h2>Comments</h2>

use strict;

use warnings;

sub something {

my $first = shift;

print "$first\n";

}

something($ARGV[0], $ARGV[1]);
What about this?

<hr>

Hi Gabor,
As a beginner of Perl scripting, I have been reading your tutorials for sometime now. I am always amazed by your simple and to the point explanation of complex concepts. I am not even a real coder- just a grad student making some boring tasks interesting by learning new and appropriate languages. Thanks for being supper clear and your dedication to help others. - Ze

I am glad I can help!

<hr>

What about shift with a hash reference?

if ( !checkusage(\%opts) ) {
usage();
}
sub checkusage {
my $opts_ref = shift;
...do something with $opts_ref
}

<hr>

Please I need your help:
I han been create the next variable:
my @dias=('2023-01-01','2023-01-02','2023-01-03');
my $cadena_promedio= "obtener_promedios(\\%HoH,";
foreach my $d (@dias){
$cadena_promedio.="\'$d\', ";
}
$cadena_promedio.=");";

&obtener_promedios(\\%HoH, '2023-01-01','2su023-01-02','2023-01-03',);

sub obtener_promedio{
my $HoH= shift;
my @dates= @_;
}

Please, what will be the value for the variables $HoH and @dates:

THANKS A LOT.
REGARDS


19 changes: 18 additions & 1 deletion sites/en/pages/use-require-import.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
=books advanced
=status show
=author szabgab
=comments_disqus_enable 1
=comments_disqus_enable 0

=abstract start

Expand Down Expand Up @@ -107,4 +107,21 @@ and only if the <hl>$holiday</hl> variable holds something that is considered Tr

Then you can call the <hl>import</hl> method of the module. If you want to.

<h2>Comments</h2>

Maybe also discuss Module::Load which is pretty cool when you want to dynamic include modules or files. Good article!

<hr>

include() function it adds the content of the page or
file into the file where this function is used.If there is any problem
in loading a file then the include() function generates a warning but the script will continue execution. require() function takes all the text in a specified
file and copies it into the file that uses the include function. If
there is any problem in loading a file then the require() function generates a fatal error and halt the execution of the script.Vistit Here for example
https://techlifediary.com/whats-difference-include-require-functions/

<hr>

I have encountered a "problem" with require in that the loaded script cannot see the <std in=""> of the calling script. (The "require" / second script cannot be amended in any way, ie moving the data in STD IN to @ARGV etc!)


2 changes: 1 addition & 1 deletion sites/en/pages/using-like-to-test-without-exact-values.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
=status show
=books testing
=author szabgab
=comments_disqus_enable 1
=comments_disqus_enable 0

=abstract start

Expand Down

0 comments on commit f4256d2

Please sign in to comment.