in reply to Program unsuspectingly dies with no reason why. -FIXED!

It might have something to do with the line &clean_the_file(); The & denotes a function reference, but you're not calling the function via a reference. If you use clean_the_file(); I think it'll take care of the issue.

Update: Never mind, I'm a loser.

Replies are listed 'Best First'.
Re^2: Program unsuspectingly dies with no reason why.
by Fletch (Bishop) on Feb 13, 2008 at 20:46 UTC

    Errm, no. Something like \&clean_the_file would be a reference. While calling subs with the leading sigil does have an effect, it's not going to stop &clean_the_file() from being called in any sane circumstance. See perlsub.

    (Of course if someone has created just such a circumstance then they deserve what they get for using prototypes where they shouldn't :)

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

Re^2: Program unsuspectingly dies with no reason why.
by kyle (Abbot) on Feb 13, 2008 at 20:48 UTC

    Actually, &foo() is a call to the sub foo. To take a reference to the sub, use \&foo.

    sub foo { print "foo: ", $_[0], "\n" } &foo( 'called with &' ); foo( 'called with no &' ); my $foo_ref = \&foo; $foo_ref->( 'called via reference' ); &$foo_ref( 'called via & and reference' ); __END__ foo: called with & foo: called with no & foo: called via reference foo: called via & and reference

    The only special thing about &foo() vs. foo() is that the former will disable any prototypes the sub may have.