in reply to foreach problem
Note that you almost certainly don't want to roll your own option-parser. For example, your parser would be perfectly happy to accept two (or zero) arguments to -U or -x, which is probably not what you want. Something like getopt is probably more appropriate.
Note that the quotes around $link in the call check_link("$link") are unnecessary—they would 'stringify' $link, but it's just a simple scalar read from a file anyway.
What is the significance of $response and $part? You perform substitutions on them, but you never seem to use them.
That last foreach loop is probably more appropriate as a while loop anyway: Unless you need to know in advance all the lines you'll be processing (which doesn't seem to be the case), it's much more memory-efficient to process them one at a time.
UPDATE: I don't have Switch installed, so I used Perl 5.10's given instead. Since ikegami says below that switch is the problem, that could be why I'm not seeing anything.
UPDATE 2: If you do want to keep your hand-rolled parser, note that you must anchor your regexes at the beginning of the string. /-/ will match a string containing a hyphen anywhere, not just at the beginning.
|
|---|