in reply to for, foreach and $_...

when using a foreach loop $_ contains the value on which you are looping. It is a shortcut so you don't actually need to say:
foreach my $app (@apps){ #stuff with $app }
and use more space with another variable in your program as minimal as that may seem when $_ or $app contains a value like '1'