Re: More compact way to write this

2009-07-02 Thread Uri Guttman
> "SB" == Steve Bertrand writes: SB> Uri Guttman wrote: >> my $item_name = $data->{item_name} ; >> $error->add_message( "item_name is undefined" ) >> unless length $item_name ; >> >> my $safe_name = $self->safe_string($item_name) ) { >> $error->add_message( >> "item_name ha

Re: More compact way to write this

2009-07-02 Thread Uri Guttman
> "SB" == Steve Bertrand writes: SB> Uri Guttman wrote: >>> "SB" == Steve Bertrand writes: >> SB> The problem I have, is that I don't like the fact that the "if" SB> condition contains the exact same line of code that a sub-section of the SB> add_message() function is receiv

Re: More compact way to write this

2009-07-02 Thread Steve Bertrand
Uri Guttman wrote: >> "SB" == Steve Bertrand writes: > > SB> The problem I have, is that I don't like the fact that the "if" > SB> condition contains the exact same line of code that a sub-section of the > SB> add_message() function is receiving as a parameter. I know there is a > SB>

Re: More compact way to write this

2009-07-02 Thread Uri Guttman
> "SB" == Steve Bertrand writes: SB> The problem I have, is that I don't like the fact that the "if" SB> condition contains the exact same line of code that a sub-section of the SB> add_message() function is receiving as a parameter. I know there is a SB> way to bundle it better, but

More compact way to write this

2009-07-02 Thread Steve Bertrand
Hi all, I've been toying with different techniques in how to make this code more compact. I have a few sanity checks like this, but against different incoming fields. The problem I have, is that I don't like the fact that the "if" condition contains the exact same line of code that a sub-section

Re: sorting anonymous arrays inside arrays

2009-07-02 Thread Jim Gibson
On 7/2/09 Thu Jul 2, 2009 12:12 PM, "daem0n...@yahoo.com" scribbled: > > Hi, > > If I have a loop that for each run creates > > while (){ >   my $value =~ /^\d/; >   $myhash{$mykey}->{'subkey'} = $value; > } > > > Normally, if I only want to sort $myhash through it's values, I would do > s

sorting anonymous arrays inside arrays

2009-07-02 Thread daem0nb0y
Hi, If I have a loop that for each run creates while (){   my $value =~ /^\d/;   $myhash{$mykey}->{'subkey'} = $value; } Normally, if I only want to sort $myhash through it's values, I would do something like: foreach (sort { $a <=> $b } keys %myhash){ print "$myhash{$_}\n"; } what if i

Redirecting STDOUT and STDERR for system()

2009-07-02 Thread Eric Veith
Hello List, as part of a Perl script of mine, I want to execute a program, get its return code AND capture its output on both STDERR and STDOUT. I tried IO::Handle, but that only gives me STDOUT and not the return code. Using qr//, I cannot read linewise and have to load the complete program's ou