in reply to Re: Use of foreach
in thread Use of foreach

And that undefined element should be (at least) the first in the array, because the OP only tries to print the first element (and then exits):

foreach (@file_names){ print $_; exit; }

citromatik

Replies are listed 'Best First'.
Re^3: Use of foreach
by naikonta (Curate) on Jun 22, 2007 at 16:36 UTC
    I guess the exit; is there to track where something goes wrong at a particular line. I prefer to put die 'OK'; somewhere before/after suspected lines, whenever I'm in hard time debugging code. The program will be instantly death with calming message: OK at __FILE__ line __LINE__.

    Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!