Re: print $myhash{key} gets SCALAR(0x1b8db540) instead of "0"

2011-02-10 Thread Rob Dixon
On 09/02/2011 21:52, gry wrote: [[v5.8.8 built for x86_64-linux-thread-multi] #!/usr/bin/perl -W use Getopt::Long; my $dml = 0; my $iterations = 10; my %options = ("dml!" => \$dml, "iterations=i" => \$iterations); GetOptions(%options) || die "bad options"; printf "dml=$dml\n"; p

Re: return ()

2011-02-10 Thread Uri Guttman
> "BM" == Brandon McCaig writes: BM> On Thu, Feb 10, 2011 at 10:20 PM, Uri Guttman wrote: >> this is all well documented. and i posted an explanation earlier in the >> thread. BM> I didn't realize this was an existing thread. In Google Mail it BM> appeared as a new thread. >>

Re: return ()

2011-02-10 Thread Brandon McCaig
On Thu, Feb 10, 2011 at 10:20 PM, Uri Guttman wrote: > this is all well documented. and i posted an explanation earlier in the > thread. I didn't realize this was an existing thread. In Google Mail it appeared as a new thread. >  BM> sub test3 >  BM> { >  BM>     my @empty_array = (); > >  BM>  

Re: return ()

2011-02-10 Thread Uri Guttman
> "BM" == Brandon McCaig writes: BM> I would have guessed an empty list, but the best way to find out is to BM> check. :) According to my tests, it's returning according to context: this is all well documented. and i posted an explanation earlier in the thread. BM> sub test1 BM> {

Re: about return

2011-02-10 Thread Ramesh Kumar
From: terry peng To: beginners Sent: Thu, February 10, 2011 2:07:43 PM Subject: about return >hello, > >when in the case "return undef" I prefer just "return" coz in list context it >will return an empty list. > >my $exist = ... >if ($exist) { > return 1; >} else { >return; >} > >the

Re: return ()

2011-02-10 Thread Brandon McCaig
2011/2/10 terry peng : > does "return ()" mean return an empty list, or just mean "return" since "()" > is optional in Perl? I would have guessed an empty list, but the best way to find out is to check. :) According to my tests, it's returning according to context: #!/usr/bin/env perl use stric

return ()

2011-02-10 Thread terry peng
does "return ()" mean return an empty list, or just mean "return" since "()" is optional in Perl? thanks!

Re: cleaning regular expression output

2011-02-10 Thread Jim Gibson
On 2/10/11 Thu Feb 10, 2011 1:07 PM, "David Jacopille" scribbled: > Is there a way to match and substitute at the same time? > > I have an html table where each row contains 11 columns of numbers. > > Unfortunately all the numbers have commas separating the thousands, millions, > etc. > > To

cleaning regular expression output

2011-02-10 Thread David Jacopille
Is there a way to match and substitute at the same time? I have an html table where each row contains 11 columns of numbers. Unfortunately all the numbers have commas separating the thousands, millions, etc. To find the number I need to match against [\d,]. What I really want is the capture ar

Re: about return

2011-02-10 Thread Uri Guttman
> "AW" == Alex Wang02 writes: AW> Terry, AW> Here is my understanding: AW> You can try defined function to verify the return value in List AW> context, you can find the return value is (undef) instead of undef AW> once the condition is false. Because you are using AW> @result=&yo

permission denied for Net::SSH::Perl module

2011-02-10 Thread Irfan Sayed
Hi All, i am using Perl :net:ssh module to connect remotely to server and execute the remote command following is the code : my %opt = ( 'options' => [ 'ForwardAgent yes','RSAuAuthentication yes','ConnectTimeout 120','ServerAliveInterval 60','ServerAliveCountMax 20','debug 1','identity_files /

Re: encapsulate static data

2011-02-10 Thread Shawn H Corey
On 11-02-09 08:57 PM, Jim Green wrote: Hello: I have some static data I want to wrap in a Data.pm, what is the best way of doing this. package data; package Data; # unless it's a pragmatic, it's capitalized use strict; use warnings; my $data=1; This is lexically scoped to the file. Use o

RE: Re[2]: about return

2011-02-10 Thread Alex Wang02
Terry, Here is my understanding: You can try defined function to verify the return value in List context, you can find the return value is (undef) instead of undef once the condition is false. Because you are using @result=&yoursubName instead of $result=&yoursubName. Please correct me if I w

Re: print $myhash{key} gets SCALAR(0x1b8db540) instead of "0"

2011-02-10 Thread gry
On Feb 9, 8:13 pm, shawnhco...@gmail.com (Shawn H Corey) wrote: > On 11-02-09 04:52 PM, gry wrote: > > > > > [[v5.8.8 built for x86_64-linux-thread-multi] > > #!/usr/bin/perl -W > > use Getopt::Long; > > my $dml = 0; > > my $iterations = 10; > > > my %options = ("dml!" =>  \$dml, > >           "ite

Re[2]: about return

2011-02-10 Thread terry peng
Thu, 10 Feb 2011 10:04:55 +0200 письмо от Shlomi Fish : > > In List context it will return an empty list. You may have meant in scalar > context in which case: > > Sorry , my typo. I did mean the scalar context. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional com

Re: about return

2011-02-10 Thread Shlomi Fish
On Thursday 10 Feb 2011 09:13:34 terry peng wrote: > Wed, 9 Feb 2011 22:44:10 -0800 (PST) письмо от "C.DeRykus" : > > On Feb 9, 10:07 pm, terry.p...@mail.ru (terry peng) wrote: > > > hello, > > > > > > when in the case "return undef" I prefer just "return" coz in list > > > context > > > > it wi