Re: Bizarre copy of HASH in list assignment...

2015-04-12 Thread Manfred Lotz
... I just worked around by using warn/die again. -- Manfred On Tue, 31 Mar 2015 13:24:31 +0300 Shlomi Fish wrote: > Hi Manfred, > > On Tue, 31 Mar 2015 10:28:13 +0200 > Manfred Lotz wrote: > > > Hi there, > > I have a script where I use croak and somebody else using

Re: Bizarre copy of HASH in list assignment...

2015-03-31 Thread Andy Bach
On Tue, Mar 31, 2015 at 3:28 AM, Manfred Lotz wrote: > > Bizarre copy of HASH in list assignment > at /usr/share/perl/5.20/Carp.pm line 228. > Hmm: http://stackoverflow.com/questions/6217317/bizarre-copy-of-unknown-in-subroutine-entry which suggests: A "Bizarre copy" oc

Re: Bizarre copy of HASH in list assignment...

2015-03-31 Thread Shlomi Fish
Hi Manfred, On Tue, 31 Mar 2015 10:28:13 +0200 Manfred Lotz wrote: > Hi there, > I have a script where I use croak and somebody else using that script > gets > > Bizarre copy of HASH in list assignment > at /usr/share/perl/5.20/Carp.pm line 228. > > I get a me

Bizarre copy of HASH in list assignment...

2015-03-31 Thread Manfred Lotz
Hi there, I have a script where I use croak and somebody else using that script gets Bizarre copy of HASH in list assignment at /usr/share/perl/5.20/Carp.pm line 228. I get a message like this, instead: Variable b has empty value! at ./x.pl line 23. main::myfunc() called at ./x.pl line

Re: list assignment

2010-04-22 Thread C.DeRykus
On Apr 20, 2:11 pm, dery...@gmail.com ("C.DeRykus") wrote: > On Apr 20, 9:38 am, jimsgib...@gmail.com (Jim Gibson) wrote: > > ... > > >> If we put $x=(1,2) then we get 2 without the error message. > > > >> Can someone please explain why? > > > > Yes, perl places the last item in the list into the v

Re: list assignment

2010-04-21 Thread Shawn H Corey
srd wrote: What really needs an explanation is if the array contains n elements then (n-2) warnings are emitted. maybe i was not so clear about my question Paul Johnson wrote: > On Tue, Apr 20, 2010 at 09:38:48AM -0700, Jim Gibson wrote: >> Yes, but as srd has observed, you get one fewer warni

Re: list assignment

2010-04-21 Thread srd
What really needs an explanation is if the array contains n elements then (n-2) warnings are emitted. maybe i was not so clear about my question -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: list assignment

2010-04-21 Thread C.DeRykus
On Apr 20, 9:38 am, jimsgib...@gmail.com (Jim Gibson) wrote: > On 4/20/10 Tue  Apr 20, 2010  9:25 AM, "Shawn H Corey" > scribbled: > > > srd wrote: > >> #!/usr/bin/env perl > >> use warnings; > >> use strict; > >> my $x= (1,2,3); > >> print $x,"\n"; > >> exit(0); > >> *

Re: list assignment

2010-04-20 Thread Paul Johnson
On Tue, Apr 20, 2010 at 09:38:48AM -0700, Jim Gibson wrote: > On 4/20/10 Tue Apr 20, 2010 9:25 AM, "Shawn H Corey" > scribbled: > > > srd wrote: > >> #!/usr/bin/env perl > >> use warnings; > >> use strict; > >> my $x= (1,2,3); > >> print $x,"\n"; > >> exit(0); > >> *

Re: list assignment

2010-04-20 Thread Jim Gibson
On 4/20/10 Tue Apr 20, 2010 9:25 AM, "Shawn H Corey" scribbled: > srd wrote: >> #!/usr/bin/env perl >> use warnings; >> use strict; >> my $x= (1,2,3); >> print $x,"\n"; >> exit(0); >> * >> output: >> Useless use of a constant in void context at ./try.plx line

Re: list assignment

2010-04-20 Thread Shawn H Corey
srd wrote: #!/usr/bin/env perl use warnings; use strict; my $x= (1,2,3); print $x,"\n"; exit(0); * output: Useless use of a constant in void context at ./try.plx line 4. 3 * If we put $x=(1,2) then we get 2 without the error

list assignment

2010-04-20 Thread srd
#!/usr/bin/env perl use warnings; use strict; my $x= (1,2,3); print $x,"\n"; exit(0); * output: Useless use of a constant in void context at ./try.plx line 4. 3 * If we put $x=(1,2) then we get 2 without the error message. Can

Re: Safe list assignment

2008-05-27 Thread Dr.Ruud
Ed Avis schreef: > Perl's list assignment feature is very useful. > > sub returns_three_things { return (1, 2, 3) } > my ($x, $y, $z) = returns_three_things(); > > Often, though, you want to add some error checking. Particularly > when providing an inte