in reply to What Is Going On Here ?????

The other approach is to avoid letting foreach default to using $_, and avoid passing $_ as an implicit argument (which your code doesn't seem to do, though I suspect you may have meant to open $_ instead of $0).
    foreach my $element ( @array ) {
        print "\"$element\"\n";
        do_something($element);
    }
An explicit loop variable helps express the code's intention, which helps when some poor fool has to pick up the code six months later.

Replies are listed 'Best First'.
Re: Re: What Is Going On Here ?????
by orthanc (Monk) on Nov 22, 2000 at 14:25 UTC

    Just like to thank everyone for their insights into this.

    and a p.s. to dws, i did mean $0 for the filename, so the script would just open itself when it was run, it saves having to supply a test file :)

    Thanks All,
    Orthanc