I'm fairly new to Perl and I cannot seem to get the correct line number from a file when using $. I'm opening the file and I'd like to know on which line number the file (which is another program) fails if it fails so that I can make better error messages for the user. Right now I'm only getting a 0 or a 1. Any help is much appreciated! Note: exit_gracefully is just a sub for error messages.
open(FH, "$command |") || exitgracefully("Could not run $command\n") +; @day_file_args = <FH>; close(FH) || (($failure = 1) && print("TestingFailure $. \n"));
In reply to Line Number Confusion by hmeharward
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |