my ( $x, $y ) = ( $n ) = Function( $arg );
print '2nd: ', Dumper \$arg, \$n, \$x, \$y;
my $count = ( $n ) = Function( $arg );
print '3nd: ', Dumper \$arg, \$n, \$count;
sub Function {
return ( 3 .. $arg );
}
__END__
--
Just my 0.0002 million dollars worth,
Shawn
Prog
On Thursday 29 Apr 2010, C.DeRykus wrote:
> Um, that won't do what you think. The () just tosses all
> the return arg's and $name remains undefined because
> of the list context.
>
> my($name) = () = Function1($arg); # $name stays undef
>
> If $name were in scalar context though, you'd get a c
On Apr 29, 4:57 am, shawnhco...@gmail.com (Shawn H Corey) wrote:
> Akhthar Parvez K wrote:
> > Hi,
>
> > The following line stores the first return value by the function Function1
> > to the variable $name:
>
> > my ($name) = @_[0] = &Function1 ($arg);
>
> > but this one doesn't work:
> > my ($nam
On Thursday 29 Apr 2010 20:57:18 Akhthar Parvez K wrote:
> On Thursday 29 Apr 2010, Shlomi Fish wrote:
> > Just do:
> >
> > my ($name) = Function1 ($arg);
> >
> > This will evaluate Function1 in list context (instead of scalar or void
> > context) and only get the first element. But the @_ of a f
Hi all,
On Thursday 29 Apr 2010 19:35:52 Shawn H Corey wrote:
> Akhthar Parvez K wrote:
> > On Thursday 29 Apr 2010, Shlomi Fish wrote:
> >> Why are you assigning to variables inside @_? It's almost always a bad
> >> idea.
> >>
> >> @_ is the function parameters' list. You should read the values
Akhthar Parvez K wrote:
On Thursday 29 Apr 2010, Shlomi Fish wrote:
Why are you assigning to variables inside @_? It's almost always a bad idea.
@_ is the function parameters' list. You should read the values from there
(using "my ($param1, $param2, $param3) = @_;" or "my $param1 = shift;" (sh
On Thursday 29 Apr 2010, Shlomi Fish wrote:
> Just do:
>
> my ($name) = Function1 ($arg);
>
> This will evaluate Function1 in list context (instead of scalar or void
> context) and only get the first element. But the @_ of a function is not
> affected by calls to other functions inside it.
Cor
On Thursday 29 Apr 2010 19:25:05 Akhthar Parvez K wrote:
> On Thursday 29 Apr 2010, Shlomi Fish wrote:
> > Why are you assigning to variables inside @_? It's almost always a bad
> > idea.
> >
> > @_ is the function parameters' list. You should read the values from
> > there (using "my ($param1, $p
Akhthar Parvez K wrote:
On Thursday 29 Apr 2010, Shlomi Fish wrote:
Why are you assigning to variables inside @_? It's almost always a bad idea.
@_ is the function parameters' list. You should read the values from there
(using "my ($param1, $param2, $param3) = @_;" or "my $param1 = shift;" (sh
On Thursday 29 Apr 2010, Shlomi Fish wrote:
> Why are you assigning to variables inside @_? It's almost always a bad idea.
>
> @_ is the function parameters' list. You should read the values from there
> (using "my ($param1, $param2, $param3) = @_;" or "my $param1 = shift;" (short
> for "shift(@
On Thursday 29 Apr 2010 14:31:38 Akhthar Parvez K wrote:
> Hi,
>
> The following line stores the first return value by the function Function1
> to the variable $name:
>
> my ($name) = @_[0] = &Function1 ($arg);
>
Why are you assigning to variables inside @_? It's almost always a bad idea.
@_ i
Akhthar Parvez K wrote:
Hi,
Hello,
The following line stores the first return value by the function Function1 to
the variable $name:
my ($name) = @_[0] = &Function1 ($arg);
The array slice @_[0] forces list context on the right side of the
assignment but warns. $name in parentheses forc
Akhthar Parvez K wrote:
Hi,
The following line stores the first return value by the function Function1 to
the variable $name:
my ($name) = @_[0] = &Function1 ($arg);
but this one doesn't work:
my ($name) = $_[0] = &Function1 ($arg);
Eventhough I've no issues to use the first one as long as i
Hi,
The following line stores the first return value by the function Function1 to
the variable $name:
my ($name) = @_[0] = &Function1 ($arg);
but this one doesn't work:
my ($name) = $_[0] = &Function1 ($arg);
Eventhough I've no issues to use the first one as long as it works well for me,
but
Vadim Kutchin wrote:
> Hi!
Hello,
> I have some function, such as:
>
> ===
> sub func1 {
> my (%rez);
>
> $rez{one} = 'one';
> $rez{two} = 'two';
> $rez{seven} = 'seven';
>
> return %rez;
> }
> ===
Vadim Kutchin schreef:
> I have some function, such as:
Missing:
use strict;
use warnings;
> ===
> sub func1 {
> my (%rez);
>
> $rez{one} = 'one';
> $rez{two} = 'two';
> $rez{seven} = 'seven';
>
> return %rez;
> }
sub func1 {
>===
>sub func1 {
>my (%rez);
>
>$rez{one} = 'one';
>$rez{two} = 'two';
>$rez{seven} = 'seven';
>
>return %rez;
>}
>===
>
>and I have such piece of code:
>
>===
>
Hi!
I have some function, such as:
===
sub func1 {
my (%rez);
$rez{one} = 'one';
$rez{two} = 'two';
$rez{seven} = 'seven';
return %rez;
}
===
and I have such piece of code:
18 matches
Mail list logo