I have a bunch of text files that follow the format
variable = value <crlf>

I am trying to read each file and insert it into SQL but before I can do
that I need to parse
the values into a hash.

One of the fields has the URL which can contain & and = characters, so after
the first split I seem to miss the rest.

I tried using the LIMIT feature of split which if I am reading it correctly
'limits the amount of times it will split'.

But I am not getting the desired results. See example

TEXT FILE HAS THIS
$method="GET";
$engname="SurfGopher";
$line="http://www.surfgopher.com/cgi-bin/submit.cgi";;
$myquery="url=$url&email=$email&i_rank=yes";

When I run the script and print the output I get this
MYQUERY =
value = www.surfgopher.com/cgi-bin/submit.cgi
value = GET
value = SurfGopher

THIS IS THE LINE OF CODE USING SPLIT
if ($_ =~ /^\$myquery/) { (undef, $line{myquery}) = split(/=/, $_, 1) }

THIS IS THE LINE PRINTING THE OUTPUT IN QUESTION
print "MYQUERY = $line{myquery}\n";


I could just do a $line =~ s/\$myquery\=//;
and be done with it, but I want to know why and how to use the LIMIT
argument.

Thanks
zack




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to