in reply to Re^4: Removing and replacing values from an array.
in thread Removing and replacing values from an array.
this code will push both URLs and IPs into both arrays
I'll assume you mean the script version, as opposed to the one-liner. You're forgetting that the reads are stateful. Specifically,
reads STDIN until it sees an empty line, and then bails. The second while (<>){ begins at that point, so if he has an empty line delimiting his IP and URL blocks, the first loop reads only the first block, and the second loop reads only the second. There is no seek, so I can' be reading the input twice.while (<>){ last if !/\S/; ... }
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Removing and replacing values from an array.
by Laurent_R (Canon) on Aug 18, 2014 at 18:55 UTC |