in reply to Re: File handles and loops
in thread File handles and loops

In addition, this

my $editor = $ENV{'editor'}; system('vim', $my_file);

should be like this:

my $editor = $ENV{'EDITOR'} || 'vim'; system($editor, $my_file);

Replies are listed 'Best First'.
Re^3: File handles and loops
by Corion (Patriarch) on Jul 31, 2012 at 08:45 UTC

    Also consider Proc::InvokeEditor. It doesn't work as nicely on Windows, as it doesn't have notepad.exe as the fallback editor there, but if you have vi(m) somewhere, it'll get used.