>>>>> "jbarry" == jbarry <[EMAIL PROTECTED]> writes:
jbarry> Thanks for the tip.
jbarry> The gist is that it's grabbing the first field in a comma delimited text
jbarry> file and making that the key. If the match fails, then something horribly
jbarry> wrong has gone on with the input file and there will be much bigger fish to
jbarry> fry.
jbarry> How would I go about making that code "safe", though?
If you never *EXPECT* the match to fail, a simple "or die" sufficies:
/(.*?),/ or die;
# $1 is now safe to use here
Otherwise, always conditionalize your code:
if (/(.*?),/) {
... it was OK, so $1 can be used
} else {
... something is wrong in denmark ...
}
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!