system(" cat $file | sort -t\\| +1 -2 > $file.out ") || die "can't sort the file: $!";
Generally, system will return 0 when it succeeds not when it fails. That code would die everytime the system call worked.
Update: As ChemBoy points out in his reply, $! is not what you want to look at. As I pointed out in a reply to another post of ChemBoy's, it only makes sense to look at $! when system returns -1 meaning that the command was not executed. This doesn't change the advice above.
-sauoq "My two cents aren't worth a dime.";
In reply to Re: Re: Re: vanishing system call
by sauoq
in thread vanishing system call
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |