SPUG: routine in foreach iterator

Martin, Asa asa.martin at attws.com
Wed May 16 13:32:26 CDT 2001


Don't use an @. Just use foreach (sub_call()) and it expands to a list
automatically. Assuming sub_call returns a list of some kind.

 - Asa

> ----------
> From: 	Jeff Saenz[SMTP:jeff.saenz at jpl.nasa.gov]
> Sent: 	Wednesday, May 16, 2001 11:04 AM
> To: 	spug-list
> Subject: 	SPUG: routine in foreach iterator
> 
> can you use a routine that returns a list as the iterator for a loop. 
> for example could i do this
> 
> foreach (@{sub_call()}) {
>    do something
> }
> 
> or would I map the sub_call inside the paren's.
> 
> jeff
> 
> 
>  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>      POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
>       Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
>   Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
>  For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
>   Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
> 
> 


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/





More information about the spug-list mailing list