If you want to skip the first line of your loop, why not simply do a <FILE> just before the loop? That reads the first line and discards it.
You do not need a chomp inside the loop. Your regex extracts the fields well before it reaches the end of the string.
Always use a three argument open. What do you think will happen when someone maliciously enters >myfile.txt as the filename argument? Indeed, bye bye file contents!
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
In reply to Re^4: Matching part of a line and saving it into a variable
by CountZero
in thread Matching part of a line and saving it into a variable
by mistamutt
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |