neat

works straight away :)

thx

martin

On Mon, Mar 11, 2002 at 02:15:59PM +0000, Jonathan E. Paton wrote:
> > so I have a dir with files:
> > 
> > /dir/foo.jpg
> >      bar.jpg
> > 
> > and I want a
> > 
> > %hashtable = (
> >                1 => 'foo',
> >                2 => 'bar'
> >              )
> > 
> > how can this be done ?
> 
> Try map:
> 
> %hashtable = map { $ctr++, $_ } @files;
> 
> Or even:
> 
> %hashtable = map { $ctr++, $_ } <*>;
> 
> Of course, I've probably got the syntax wrong - since I
> don't use map that often.  You can, of course, write many
> programs in terms of sub/map like:
> 
> sub add {
>     return map {
>         #do processing
>     } @_;
> }
> 
> which can really annoy your coworkers.
> 
> Jonathan Paton
> 
> __________________________________________________
> Do You Yahoo!?
> Everything you'll ever need on one web page
> from News and Sport to Email and Music Charts
> http://uk.my.yahoo.com
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-- 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to