oldwarrior32 has asked for the wisdom of the Perl Monks concerning the following question:
Dear monks. A noob asking for your wisdom again. I did the respectively search in the monastery and the profane Google with no luck.
I have this code:
foreach(@a){ $temp = $_; $test = grep($temp eq $_,@b); print "$test\n"; }
As you can see I needed a '$temp' variable to make the thing work.
Is there a way to evaluate the grep expresion using only default variables, or the '$temp' variables is completely necessary?
Thanks for your help.
By the way, the program just output the amount of elements from array @a that are not in array @b.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Default variable within loops
by Kenosis (Priest) on Jun 21, 2012 at 03:16 UTC | |
by cheekuperl (Monk) on Jun 21, 2012 at 03:23 UTC | |
by Kenosis (Priest) on Jun 21, 2012 at 03:28 UTC | |
Re: Default variable within loops
by aaron_baugher (Curate) on Jun 21, 2012 at 04:04 UTC | |
Re: Default variable within loops
by muba (Priest) on Jun 21, 2012 at 02:41 UTC | |
Re: Default variable within loops
by Kenosis (Priest) on Jun 21, 2012 at 04:44 UTC | |
Re: Default variable within loops
by frozenwithjoy (Priest) on Jun 21, 2012 at 03:03 UTC | |
Re: Default variable within loops
by stevieb (Canon) on Jun 21, 2012 at 03:12 UTC | |
Re: Default variable within loops
by zentara (Archbishop) on Jun 21, 2012 at 11:59 UTC | |
Re: Default variable within loops
by cheekuperl (Monk) on Jun 21, 2012 at 03:09 UTC | |
Re: Default variable within loops
by Anonymous Monk on Jun 21, 2012 at 13:03 UTC | |
Re: Default variable within loops
by oldwarrior32 (Sexton) on Jun 21, 2012 at 03:58 UTC |
Back to
Seekers of Perl Wisdom