Re: Piping commands into cli perl

2010-07-09 Thread Steve Bertrand
On 2010.07.09 21:57, Uri Guttman wrote: >> "SB" == Steve Bertrand writes: > > SB> On 2010.07.09 21:40, Uri Guttman wrote: > > >> what input? i see none there. but what you want is either -p or -n. both > >> are among the most useful options for perl oneliners. look them up in > >> pe

Re: Piping commands into cli perl

2010-07-09 Thread Uri Guttman
> "SB" == Steve Bertrand writes: SB> On 2010.07.09 21:40, Uri Guttman wrote: >> what input? i see none there. but what you want is either -p or -n. both >> are among the most useful options for perl oneliners. look them up in >> perlrun and pick which one you want. SB> | perl -p

Re: Piping commands into cli perl

2010-07-09 Thread Steve Bertrand
On 2010.07.09 21:40, Uri Guttman wrote: >> "SB" == Steve Bertrand writes: > > SB> But alas, I get nothing, so I tried this as my last line, thinking that > SB> the input would be put in $_: > > SB> perl -e '$_ =~ s/.*\s+//; print $_' > > what input? i see none there. but what you want

Re: Piping commands into cli perl

2010-07-09 Thread Uri Guttman
> "SB" == Steve Bertrand writes: SB> But alas, I get nothing, so I tried this as my last line, thinking that SB> the input would be put in $_: SB> perl -e '$_ =~ s/.*\s+//; print $_' what input? i see none there. but what you want is either -p or -n. both are among the most useful opt

Piping commands into cli perl

2010-07-09 Thread Steve Bertrand
I have slowly been finding using perl at the cli more and more useful, but I'm confused as to how to do certain tasks. Although the following pipeline is hugely ugly and I know that it can be shortened extremely, from time-to-time I just like to play around with all manner of manipulation. So, Per

net::sftp ls() error

2010-07-09 Thread mtice
Hello, I'm trying to perform an ls() on a remote nested directory using the Net::SFTP module. It's throwing back a strange error. If I do an ls() at the root dir everything comes back fine - it's just the nested dir that has an issue. Here is my code: #!/usr/bin/perl use Net::SFTP; use

Re: I don't wont to create more lines of code then the necessary

2010-07-09 Thread Chas. Owens
On Fri, Jul 9, 2010 at 12:08, marcos rebelo wrote: > The idea is really to count the lines, This will run in a test and > seems to me the most clear code. > > the original code is +-: > is( scalar( split( /\n/, $trap->stdout ) ) ), 15); > > The lines have no special order. The idiomatic way of co

Re: I don't wont to create more lines of code then the necessary

2010-07-09 Thread marcos rebelo
The idea is really to count the lines, This will run in a test and seems to me the most clear code. the original code is +-: is( scalar( split( /\n/, $trap->stdout ) ) ), 15); The lines have no special order. Best Regards Marcos Rebelo On Fri, Jul 9, 2010 at 3:42 PM, Chas. Owens wrote: > On Fr

Re: I don't wont to create more lines of code then the necessary

2010-07-09 Thread Chas. Owens
On Fri, Jul 9, 2010 at 09:22, Chas. Owens wrote: snip > { >    my @temp = split /\n/, "first\nsecond\nthird"; >    xpto @temp; > } snip Or you use the [CountOf secret operator][1] to count the number of items split returns, but not well the use of a -1 limit on the split. If you don't provide a n

Re: I don't wont to create more lines of code then the necessary

2010-07-09 Thread Chas. Owens
On Fri, Jul 9, 2010 at 06:16, marcos rebelo wrote: > I'm getting crazy with this one > > the fact of or not the prototype in the xpto function, I get this > warning: 'Use of implicit split to @_ is deprecated at script.pl line > 5.' > > use strict; > use warnings; > > sub xpto($) {}; > xpto( split

Re: I don't wont to create more lines of code then the necessary

2010-07-09 Thread Steve Bertrand
On 2010.07.09 08:34, Robert Wohlfarth wrote: > On Fri, Jul 9, 2010 at 5:16 AM, marcos rebelo wrote: > >> the fact of or not the prototype in the xpto function, I get this >> warning: 'Use of implicit split to @_ is deprecated at script.pl line >> 5.' >> >> use strict; >> use warnings; >> >> sub x

Re: I don't wont to create more lines of code then the necessary

2010-07-09 Thread Robert Wohlfarth
On Fri, Jul 9, 2010 at 5:16 AM, marcos rebelo wrote: > the fact of or not the prototype in the xpto function, I get this > warning: 'Use of implicit split to @_ is deprecated at script.pl line > 5.' > > use strict; > use warnings; > > sub xpto($) {}; > xpto( split(/\n/, "fv\nfg" ) ); > I believe

I don't wont to create more lines of code then the necessary

2010-07-09 Thread marcos rebelo
I'm getting crazy with this one the fact of or not the prototype in the xpto function, I get this warning: 'Use of implicit split to @_ is deprecated at script.pl line 5.' use strict; use warnings; sub xpto($) {}; xpto( split(/\n/, "fv\nfg" ) ); How do I go around this without creating more li