Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

My problem is probably an easy one for smart Perl Monks..
I have made a function which I want to call several times, but with different arguments. The arguments I want to pass is "user-[a-z]". Also the fist time my function is called,the argument passed is supposed to be "user-a", second "user-b" and so on...
Any smart idea's?:)

Thanx...

20030211 Edit by Corion : Changed title

Replies are listed 'Best First'.
Re: simple problem...
by steves (Curate) on Feb 10, 2003 at 11:47 UTC

    You mean like this?

    sub foo { my $user = shift; print "$user\n"; } for my $user_id ('a'..'z') { foo("user-$user_id"); }
Re: simple problem...
by Hofmator (Curate) on Feb 10, 2003 at 11:51 UTC
    If I understand you correctly, this should do what you want: my_func("user-$_") for 'a'..'z';

    -- Hofmator