Re: stripped output from Net::SSH2

2010-03-11 Thread Sisyphus
- Original Message - From: "perl_haxor 123" To: "Sisyphus" Cc: Sent: Thursday, March 11, 2010 6:38 AM Subject: Re: stripped output from Net::SSH2 find the script below: #!/usr/bin/perl -w use strict; use Term::ReadKey; use Net::SSH2; use constant BUFLEN => 10_; my $user =

Re: stripped output from Net::SSH2

2010-03-11 Thread perl_haxor 123
Hi Rob, Thanks a lot for looking into thisi can't execute cat command on the routing devices, I was trying "sh run" on two devices, the show run command dumps the current configuration of the routing device..i tried executing "sh run" on two devices, one of the device has less config

Re: why on while?

2010-03-11 Thread Dr.Ruud
Jeff Peng wrote: so how about while (my $line = ) instead of using $_? Evil! An empty line, or a line with only a "0" in it. -- Ruud -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: why on while?

2010-03-11 Thread Nik J
> > >   BRH> My question is:  why?  Seems like such an easy thing to have done. > The answer is simple, the docs say so. The docs state the following in "perldoc perlsyn" under section "Foreach Loops": If the variable is preceded with the keyword "my", then it is lexically scoped, and i

Re: why on while?

2010-03-11 Thread Shawn H Corey
Dr.Ruud wrote: > Jeff Peng wrote: > >> so how about while (my $line = ) instead of using $_? > > Evil! An empty line, or a line with only a "0" in it. > Not quite. Lines are not completely empty. A blank line would have "\n". A line with just zero would have "0\n". Only after a chomp would

Re: why on while?

2010-03-11 Thread John W. Krahn
Dr.Ruud wrote: Jeff Peng wrote: so how about while (my $line = ) instead of using $_? Evil! An empty line, or a line with only a "0" in it. Evil? "while (my $line = )" is *exactly* the same as "while (defined(my $line = ))" $ perl -e' my $x = 1; my $data = "one\ntwo\nthree\n0"; open FH,

Re: why on while?

2010-03-11 Thread John W. Krahn
Shawn H Corey wrote: Dr.Ruud wrote: Jeff Peng wrote: so how about while (my $line = ) instead of using $_? Evil! An empty line, or a line with only a "0" in it. Not quite. Lines are not completely empty. A blank line would have "\n". A line with just zero would have "0\n". Only after a

Re: why on while?

2010-03-11 Thread Shawn H Corey
John W. Krahn wrote: > That is not "evil"... I was being facetious. No technology is evil, just the uses you put it to. :) -- Just my 0.0002 million dollars worth, Shawn Programming is as much about organization and communication as it is about coding. I like Perl; it's the only langu

Module for determining OS type, OS Version, and Processor Architecture

2010-03-11 Thread Nik J
All, I'm searching for a Perl module that will make it easy determine the following: OS Type: windows *unix OS Version: WindowXP, Windows Vista, Windows Server 2003, etc. Solaris 5.10, Solaris 5.8, Linux RedHat x.x, etc. Processor Architecture: i386, sparc, etc. Is there anythin

Re: Module for determining OS type, OS Version, and Processor Architecture

2010-03-11 Thread trapd00r
On 10/03/10 13:07 -0800, Nik J wrote: I'm searching for a Perl module that will make it easy determine the following: OS Type: windows *unix print $^0; -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: why on while?

2010-03-11 Thread Peter Scott
On Wed, 10 Mar 2010 10:49:16 +0100, Dr.Ruud wrote: > Jeff Peng wrote: > >> so how about while (my $line = ) instead of using $_? > > Evil! An empty line, or a line with only a "0" in it. Not so: $ perl -MO=Deparse -e 'while(my $l=) {}' while (defined(my $l = )) { do { () }; } -

Re: Module for determining OS type, OS Version, and Processor Architecture

2010-03-11 Thread Shawn H Corey
trapd...@trapd00r.se wrote: > On 10/03/10 13:07 -0800, Nik J wrote: >> I'm searching for a Perl module that will make it easy determine the >> following: >> >> OS Type: >> windows >> *unix >> > print $^0; > That would be $^O(dollar, control-capital-O) or: perl -E 'use English q(-no_matc

Re: Module for determining OS type, OS Version, and Processor Architecture

2010-03-11 Thread trapd00r
On 10/03/10 13:07 -0800, Nik J wrote: I'm searching for a Perl module that will make it easy determine the following: OS Type: windows *unix $^O; -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: why on while?

2010-03-11 Thread Uri Guttman
> "R" == Ruud writes: R> Jeff Peng wrote: >> so how about while (my $line = ) instead of using $_? R> Evil! An empty line, or a line with only a "0" in it. empty lines (a single newline) is always true. the defined case only handles the odd trailing partial line with just '0' in it.

Re: why on while?

2010-03-11 Thread Uri Guttman
> "SHC" == Shawn H Corey writes: SHC> Dr.Ruud wrote: >> Jeff Peng wrote: >> >>> so how about while (my $line = ) instead of using $_? >> >> Evil! An empty line, or a line with only a "0" in it. >> SHC> Not quite. Lines are not completely empty. A blank line would have

Re: Writing tests for module utility scripts

2010-03-11 Thread Jay Savage
On Wed, Mar 10, 2010 at 8:43 PM, Steve Bertrand wrote: > Hi all, > > I've got a module that has a significant number of unit tests for each > sub, each within its own file: > > acct-dev: ISP-RADIUS % ls t | grep daily > 07-aggregate_daily.t > > Within the overall package, I've included a few utili

Re: Module for determining OS type, OS Version, and Processor Architecture

2010-03-11 Thread Paul Johnson
On Wed, Mar 10, 2010 at 01:07:00PM -0800, Nik J wrote: > All, > > I'm searching for a Perl module that will make it easy determine the > following: > > OS Type: >windows >*unix > > OS Version: > WindowXP, Windows Vista, Windows Server 2003, etc. >Solaris 5.10, Solaris 5.8, Linux

Re: use with variable

2010-03-11 Thread Paul Johnson
On Wed, Mar 10, 2010 at 04:48:54PM +0100, Christoph Friedrich wrote: > Could I also write > > eval { use Env::Sourced "$oraenv"; } or die "Error in Eval $_"; > > to do the use on run time? You'd need string eval: eval "use ..." See also Shell::Source which doesn't do the work at compile time.

assign s/// value to a scalar

2010-03-11 Thread raphael()
#!/usr/bin/env perl use strict; use warnings; my @array = qw ( http://abc.com/files/randomthings/A/1.html http://abc.com/files/randomthings/A/2.html ); for ( @array ) { # This works # s!/A/\d+.html$!!; $url = $_; # Doesn't work ~ gives "1" ( my $url ) = ( $_ ) =~ s!/A/\d+.html$!!;

Re: assign s/// value to a scalar

2010-03-11 Thread John W. Krahn
raphael() wrote: #!/usr/bin/env perl use strict; use warnings; my @array = qw ( http://abc.com/files/randomthings/A/1.html http://abc.com/files/randomthings/A/2.html ); for ( @array ) { # This works # s!/A/\d+.html$!!; $url = $_; Not quite, that should be: s!/A/\d+\.html$!!; $url

Re: assign s/// value to a scalar

2010-03-11 Thread Steve Bertrand
On 2010.03.12 00:33, John W. Krahn wrote: > raphael() wrote: >> #!/usr/bin/env perl >> >> use strict; >> use warnings; >> >> my @array = qw ( >> http://abc.com/files/randomthings/A/1.html >> http://abc.com/files/randomthings/A/2.html >> ); >> >> for ( @array ) { >> >> # This works >> # s!/A/\d+

Re: assign s/// value to a scalar

2010-03-11 Thread Uri Guttman
> "SB" == Steve Bertrand writes: SB> Am I correct in thinking that this: SB> $url = $file =~ m{ (.*) /A/\d+.html }x; SB> ...assigns '1' to $url because =~ binds tighter and assigns a 'true' SB> value to $url, whereas: SB> ( $url ) = $file =~ m{ (.*) /A/\d+.html }x; SB> ...$url

Re: why on while?

2010-03-11 Thread Jeff Peng
On Fri, Mar 12, 2010 at 2:21 AM, Uri Guttman wrote: > empty lines (a single newline) is always true. the defined case only > handles the odd trailing partial line with just '0' in it. it is the > only way a <> without defined would lose some data as it is false. > No. Even having just 0 in a lin

Re: why on while?

2010-03-11 Thread Uri Guttman
> "JP" == Jeff Peng writes: JP> On Fri, Mar 12, 2010 at 2:21 AM, Uri Guttman wrote: >> empty lines (a single newline) is always true. the defined case only >> handles the odd trailing partial line with just '0' in it. it is the >> only way a <> without defined would lose some data as

Perl Beginners

2010-03-11 Thread Sudheer K
Hi ALL I am planning to start programming perl for my project . i am just a beginner to perl can i get information related to videos/links and books especially for beginners which can help me writing scripts . Thanks

Re: Perl Beginners

2010-03-11 Thread Aravind Venkatesan
Hi, Well I feel the lecture series hosted by IIT is useful (it was for me at least). http://www.youtube.com/watch?v=1pVolaKhxVM The lectures are conducted by Prof. Sengupta. I hope you find it useful. Cheers, Aravind Sudheer K wrote: Hi ALL I am planning to start programming perl for my p

Re: Perl Beginners

2010-03-11 Thread trapd00r
On 12/03/10 12:48 +0530, Sudheer K wrote: I am planning to start programming perl for my project . i am just a beginner to perl can i get information related to videos/links and books especially for beginners which can help me writing scripts . http://www.perl.org/learn.html http://www.perl.or