On Tue, 24 Dec 2002 14:04:45 -0800 (PST) "Roderick A. Anderson" <[EMAIL PROTECTED]> 
wrote:

> This is probably off topic but I'm hoping only slightly so.  I have a
> script that may select zero or more rows.  (I asked here and got some help
> with checking the count and that works quite nice.)  
>    If there are no rows returned do one thing, if many rows are returned
> offer a selection list, and finally if there is only one row display the
> results.
> 
> The problem I'm having is how to do in a one-liner the equivalent of this.  
> Getting the the $domainname_key out of the arrayref $domain_array.
> 
> foreach my $row (@$domain_array) {
>         ($domainname_key, $jnk) = @$row;
> )

That should be a '}'.

> As usual any and all help is appreciated.

You can do anything in a one-liner that you can do in a script, but that
line can get awful long.  If it gets more than two wrapped lines, I'd
recommend breaking down and using a script file.  If it's a matter of
honor, imbed the logic in a package module and call subroutines from the
package.

 foreach my $row (@$domain_array) { ($domainname_key, $jnk) = @$row; }
or
 perl -MMyPackage 'some_sub()'

-- 
Mac :})
** I normally forward private questions to the appropriate mail list. **
Ask Smarter: http://www.tuxedo.org/~esr/faqs/smart-questions.html
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.


Reply via email to