Re: if else elsif

2011-03-18 Thread Katie T
It would help if you could clarify what you expect the following chunk of code to achieve: my @data = ( split /;/ )[31,32,38,39,261]; if (@data[39] =~ /15/) { 2 } else { 1 }

Re: Using perl to automate add user on linux/freebsd systems

2011-03-18 Thread Katie T
On Thu, Mar 17, 2011 at 3:19 PM, Salvador Fandino wrote: > On 03/14/2011 07:59 PM, siegfr...@heintze.com wrote: > >> Does anyone know the perl API (presumably on CPAN) for >> useradd/userdel/usermod to automate the manipulation of users on FreeBSD >> systems? On Linux systems? >> thanks, >> Siegfr

Error Netcdf

2011-03-18 Thread indrag
Please help me, why this message appear. * /work/radar/radar_mkCAPPI/volume/Husein_20110221/201102211442 cp: omitting directory `/work/radar/radar_mkCAPPI/volume/Husein_20110221/201102211442' ncopen: filename "test.nc": NetCDF: Unknown file format th

Re: Error Netcdf

2011-03-18 Thread Chas. Owens
On Fri, Mar 18, 2011 at 10:42, wrote: > Please help me, why this message appear. > * > /work/radar/radar_mkCAPPI/volume/Husein_20110221/201102211442 > cp: omitting directory > `/work/radar/radar_mkCAPPI/volume/Husein_20110221/201102211442' > ncopen: fi

RE: sub routine

2011-03-18 Thread Chris Stinemetz
Thanks Uri. I've been reading perldoc perlsub and have a better understanding about subroutines, but I am still stuck. Any help is greatly appreciated. The error I am getting is: Global symbol "%record" requires explicit package name at ./DOband1.pl line 20. Global symbol "$line" requires expli

RE: sub routine

2011-03-18 Thread Sunita Rani Pradhan
Hi Christ In sub Dist() , you need define scope of each variable as my or our or local , which is line no.20 . Regards Sunita -Original Message- From: Chris Stinemetz [mailto:cstinem...@cricketcommunications.com] Sent: Friday, March 18, 2011 9:18 PM To: Uri Guttman Cc: be

Re: Parse Key=Val parameters with s///eg

2011-03-18 Thread C.DeRykus
On Mar 17, 3:44 pm, c...@pobox.com (Chap Harrison) wrote: > On Mar 17, 2011, at 5:21 PM, Rob Dixon wrote: > > > A s///g is 'successful' if it performs at least one substitution, in which > > case it will return the number of substitutions made. In your code, it will > > find as many key=value sub

shift oo

2011-03-18 Thread shawn wilson
i ran across a peace of interesting code: my $writer = shift->( [ 200, [ "Content-type" => "text/plain" ], $s ] ); so, if i understand this correctly, this would be the same as my $writer = sub { my $a = shift; my $thing = sub { my $subthing = $writer->{ $a }; return [ 200, [ "Content-typ

Re: shift oo

2011-03-18 Thread Uri Guttman
> "sw" == shawn wilson writes: sw> i ran across a peace of interesting code: sw> my $writer = shift->( sw> [ 200, [ "Content-type" => "text/plain" ], $s ] sw> ); first off, there is no OO anywhere in that code. all it is is a dereference of a code reference passed in to a sub. sw

Re: shift oo

2011-03-18 Thread Shawn H Corey
On 11-03-18 04:31 PM, shawn wilson wrote: my $writer = shift->( [ 200, [ "Content-type" => "text/plain" ], $s ] ); shift will shift @_ in a sub and @ARGV outside of one. So the first question is this inside a sub or not? The first item in the array (@_ or @ARGV) has to be a reference to

Re: shift oo

2011-03-18 Thread shawn wilson
On Fri, Mar 18, 2011 at 4:50 PM, Uri Guttman wrote: > > "sw" == shawn wilson writes: > > sw> i ran across a peace of interesting code: > sw> my $writer = shift->( > sw> [ 200, [ "Content-type" => "text/plain" ], $s ] > sw> ); > > first off, there is no OO anywhere in that code. all it i

Re: shift oo

2011-03-18 Thread shawn wilson
On Fri, Mar 18, 2011 at 4:51 PM, Shawn H Corey wrote: > On 11-03-18 04:31 PM, shawn wilson wrote: > >> my $writer = shift->( >> [ 200, [ "Content-type" => "text/plain" ], $s ] >> ); >> > > shift will shift @_ in a sub and @ARGV outside of one. So the first > question is this inside a sub or not

Re: shift oo

2011-03-18 Thread Uri Guttman
> "sw" == shawn wilson writes: please learn how to quote emails properly. it is hard to tell here what i replied and what you wrote. sw> On Fri, Mar 18, 2011 at 4:50 PM, Uri Guttman wrote: >> > "sw" == shawn wilson writes: >> sw> i ran across a peace of interesting code: sw

Re: shift oo

2011-03-18 Thread Shawn H Corey
On 11-03-18 05:05 PM, shawn wilson wrote: my $writer = sub { my $a = shift; return [ 200, [ "Content-type" => "text/plain" ], $s ]; } Try: $sub_ref = shift @_; my $writer = $subref->( [ 200, [ "Content-type" => "text/plain" ], $s ] ); The shift is shifting @_; it should be written as:

Re: shift oo

2011-03-18 Thread Uri Guttman
> "SHC" == Shawn H Corey writes: SHC> On 11-03-18 04:31 PM, shawn wilson wrote: >> my $writer = shift->( >> [ 200, [ "Content-type" => "text/plain" ], $s ] >> ); SHC> shift will shift @_ in a sub and @ARGV outside of one. So the first SHC> question is this inside a sub or not?

Re: shift oo

2011-03-18 Thread shawn wilson
On Fri, Mar 18, 2011 at 5:23 PM, Uri Guttman wrote: > > "sw" == shawn wilson writes: > > please learn how to quote emails properly. it is hard to tell here what > i replied and what you wrote. > > sorry, i don't know how to do any better in gmail (and does it different on the gmail app on my

Re: shift oo

2011-03-18 Thread Uri Guttman
> "sw" == shawn wilson writes: sw> On Fri, Mar 18, 2011 at 5:23 PM, Uri Guttman wrote: >> > "sw" == shawn wilson writes: >> >> please learn how to quote emails properly. it is hard to tell here what >> i replied and what you wrote. >> >> sorry, i don't know how to do any

Re: shift oo

2011-03-18 Thread shawn wilson
On Fri, Mar 18, 2011 at 5:45 PM, Uri Guttman wrote: > > "sw" == shawn wilson writes: > > > sw> On Fri, Mar 18, 2011 at 5:23 PM, Uri Guttman > wrote: > >> > "sw" == shawn wilson writes: > >> >> > >> >> so, what your saying is: > >> > sw> my $writer = sub { > sw> my $a = shift; >

Re: Parse Key=Val parameters with s///eg

2011-03-18 Thread Chap Harrison
On Mar 18, 2011, at 12:03 PM, C.DeRykus wrote: > Neat solution. IMO, though, it's much clearer and simpler > (particularly for subsequent maintainers), to identify errors > up front if you can and save the time and complexity to > review \G and pos() and the implication of a s/// return > count

Re: shift oo

2011-03-18 Thread shawn wilson
On Fri, Mar 18, 2011 at 6:21 PM, shawn wilson wrote: > > > On Fri, Mar 18, 2011 at 5:45 PM, Uri Guttman wrote: > >> > "sw" == shawn wilson writes: >> >> >> sw> On Fri, Mar 18, 2011 at 5:23 PM, Uri Guttman >> wrote: >> >> > "sw" == shawn wilson writes: >> >> > ok, taking another crac

Re: shift oo

2011-03-18 Thread Shawn H Corey
On 11-03-18 06:21 PM, shawn wilson wrote: my $a = Streamer->new; my $app = sub { return [ 200, [ "Content-type" => "text/plain" ], $a->open_fh ]; } ... i think, but a part of me is thinking that if it were that simple, it would have written like that (bad reasoning for thinking i'm wrong, but

Re: shift oo

2011-03-18 Thread shawn wilson
On Fri, Mar 18, 2011 at 6:36 PM, Shawn H Corey wrote: > On 11-03-18 06:21 PM, shawn wilson wrote: > >> my $a = Streamer->new; >> my $app = sub { >> return [ 200, [ "Content-type" => "text/plain" ], $a->open_fh ]; >> } >> >> ... i think, but a part of me is thinking that if it were that simple, i

Re: shift oo

2011-03-18 Thread Shawn H Corey
On 11-03-18 06:41 PM, shawn wilson wrote: an argument to what sub? (it's obvious that i've missed the boat on this concept) my $writer = shift->( [ 200, [ "Content-type" => "text/plain" ], $s ] ); The array @_ contains a sub ref as its first argument. It is this sub that

Re: shift oo

2011-03-18 Thread shawn wilson
On Fri, Mar 18, 2011 at 7:02 PM, Shawn H Corey wrote: > On 11-03-18 06:41 PM, shawn wilson wrote: > >> an argument to what sub? >> (it's obvious that i've missed the boat on this concept) >> > > my $writer = shift->( >[ 200, [ "Content-type" => "text/plain" ], $s ] >); > > The

Re: shift oo

2011-03-18 Thread Uri Guttman
> "sw" == shawn wilson writes: sw> On Fri, Mar 18, 2011 at 7:02 PM, Shawn H Corey wrote: >> my sub_ref = shift @_; >> my $writer = $sub_ref->( >> [ 200, [ "Content-type" => "text/plain" ], $s ] >> ); sw> oh, that's right, i forgot the general oo use of: sw> my( $self, @etc )

Re: Parse Key=Val parameters with s///eg

2011-03-18 Thread Brian Fraser
Yes and no. Technically I suppose you can, maybe doing something like this: use 5.010; use Data::Dumper; $_ = "KEYWORD = VALUE MIN=2 MAX, = 12 WEIGHTED TOTAL= 20 WHAT =, 12 TEST = 1000"; our %results; m! (?&RECURSE) (?(DEFINE) (? (?&BAD_LVSIDE)|(?&BAD_RVSIDE) ) (? (?&P_PLUS) = (?&P_STAR) ) (? (

printf explicitly

2011-03-18 Thread Chris Stinemetz
Hello, I would like to explicitly use printf '<%.2g>' for the element in the array called dist. Below is the error I am getting and below that is a sample of the output I can currently generate before I add printf. Thank you Argument "2,1,1,1175,2.58522727272727,1\n" isn't numeric in printf at

Re: printf explicitly

2011-03-18 Thread Uri Guttman
> "CS" == Chris Stinemetz writes: CS> I would like to explicitly use printf '<%.2g>' for the element in CS> the array called dist. Below is the error I am getting and below CS> that is a sample of the output I can currently generate before I CS> add printf. CS> Thank you CS> Ar