Naming multiple variables with the same name like you did ($args, %args) is
a
bad idea. because when you want to access the value of the hash %args
($args{FN}) you are accessing in reality what was shifted in the scalar
$args and not the hash %args
because perl use simbolic reference.
here is a
On Sun, Jan 15, 2017 at 12:45:41PM -0800, al...@myfastmail.com wrote:
> Hi
>
> On Sun, Jan 15, 2017, at 12:23 PM, Илья Рассадин wrote:
> > I think, you can use this aproach
>
> If I use either of those
>
>
> sub modrec {
> - my %args = %{ shift @_ };
> +
On Sun, Jan 15, 2017, 16:19 wrote:
Hi,
On Sun, Jan 15, 2017, at 01:01 PM, Shawn H Corey wrote:
> > Is there a different, recommended way?
>
> Nothing's wrong. perlcritic does not this valid method, that's all.
>
> TIMTOWTDI (There Is More Than One Way To Do It.)
Hm, ok.
Hi Alan
You are unpacking `@_` in a way, but perlcritic doesn't recognise doing it this
way.
I think you'd be better off without dereferencing the hash, and using a slice
to assign your local variables. I would write your subroutine like this
sub modrec {
my ($args) = @_;
Hi,
On Sun, Jan 15, 2017, at 01:01 PM, Shawn H Corey wrote:
> > Is there a different, recommended way?
>
> Nothing's wrong. perlcritic does not this valid method, that's all.
>
> TIMTOWTDI (There Is More Than One Way To Do It.)
Hm, ok. As long as it's not wrong/broken in some weird way.
I
On Sun, 15 Jan 2017 12:09:53 -0800
al...@myfastmail.com wrote:
> What's wrong with the way I'm unpacking the arguments passed to the
> subroutine,
>
> my %args = %{ shift @_ };
>
> Is there a different, recommended way?
Nothing's wrong. perlcritic does not this valid method, that's all.
Hi!
You forgot arrow operator
$args->{'FN'}, not $args{'FN'}
15.01.17 23:45, al...@myfastmail.com пишет:
Hi
On Sun, Jan 15, 2017, at 12:23 PM, Илья Рассадин wrote:
I think, you can use this aproach
If I use either of those
sub modrec {
- my %args = %{ shift
Hi
On Sun, Jan 15, 2017, at 12:23 PM, Илья Рассадин wrote:
> I think, you can use this aproach
If I use either of those
sub modrec {
- my %args = %{ shift @_ };
+ my ($args) = @_;
30 my $fn = $args{FN};
Hi!
I think, you can use this aproach
sub modrec {
my ($args) = @_; # or my $args = shift @_; use what you like more
my $fn = $args->{'FN'};
}
15.01.17 23:09, al...@myfastmail.com пишет:
Hi,
I have a simple script with a subroutine that I pass scalar & array arguments
Hi,
I have a simple script with a subroutine that I pass scalar & array arguments
to,
#!/usr/bin/perl
use 5.01201;
use strict;
use warnings;
my $this_fn = "input.txt";
my @this_dr = qw(
/path/1
/path/2
);
my
10 matches
Mail list logo