M
Michael Hill
I have this input from a <textarea> object that is being submitted to a
script.
The input looks like:
<path fill="none" stroke="#000000" d="M0.437,185.49l87-156"/>
<path fill="none" stroke="#000000" d="M87.437,29.49l140-29"/>
<path fill="none" stroke="#000000" d="M227.437,0.49l39,118"/>
<path fill="none" stroke="#000000" d="M266.437,118.49l-104,160"/>
<path fill="none" stroke="#000000" d="M159.437,276.49l-32-101"/>
<path fill="none" stroke="#000000" d="M127.437,175.49l-127,10"/>
I'd like to get where the output for:
foreach $i (@arr)
{
($x, $y) = @$i;
print "d=$x,$y<br>";
}
should be:
d="0.437,185.49"
d="87.437,29.49"
d="227.437,0.49"
d="266.437,118.49"
d="159.437,276.49"
d="127.437,175.49"
This is where I am:
****************************************************************
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);
$value =~ s/%09//g; #strip the tabs out all of them
$value =~ s/%3C//g; #strip the < all of them
$value =~ s/%2F%3E//g; #strip the /> all of them
$value =~ s/%22//g; #strip the " all of them
$value =~ s/%23//g; #strip the # all of them
$value =~ s/%3D/=/g; #change %3D to = all of them
$value =~ s/%2C/,/g; #change %2C to , all of them
$value =~ s/%0D%0A//g; #strip out the carriage returns
$value =~ s/path//g; #strip out the word path .....
hmmm what if i have 'PATH' or Path or paTH? Need mod here
if ( $name eq 'path' )
{
$path = $value;
}
}
@arr = split(/+/, $path);
foreach $i (@arr)
{
($x, $y) = @$i;
print "d=$x,$y<br>";
}
Any help is appreciated.
Mike
script.
The input looks like:
<path fill="none" stroke="#000000" d="M0.437,185.49l87-156"/>
<path fill="none" stroke="#000000" d="M87.437,29.49l140-29"/>
<path fill="none" stroke="#000000" d="M227.437,0.49l39,118"/>
<path fill="none" stroke="#000000" d="M266.437,118.49l-104,160"/>
<path fill="none" stroke="#000000" d="M159.437,276.49l-32-101"/>
<path fill="none" stroke="#000000" d="M127.437,175.49l-127,10"/>
I'd like to get where the output for:
foreach $i (@arr)
{
($x, $y) = @$i;
print "d=$x,$y<br>";
}
should be:
d="0.437,185.49"
d="87.437,29.49"
d="227.437,0.49"
d="266.437,118.49"
d="159.437,276.49"
d="127.437,175.49"
This is where I am:
****************************************************************
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);
$value =~ s/%09//g; #strip the tabs out all of them
$value =~ s/%3C//g; #strip the < all of them
$value =~ s/%2F%3E//g; #strip the /> all of them
$value =~ s/%22//g; #strip the " all of them
$value =~ s/%23//g; #strip the # all of them
$value =~ s/%3D/=/g; #change %3D to = all of them
$value =~ s/%2C/,/g; #change %2C to , all of them
$value =~ s/%0D%0A//g; #strip out the carriage returns
$value =~ s/path//g; #strip out the word path .....
hmmm what if i have 'PATH' or Path or paTH? Need mod here
if ( $name eq 'path' )
{
$path = $value;
}
}
@arr = split(/+/, $path);
foreach $i (@arr)
{
($x, $y) = @$i;
print "d=$x,$y<br>";
}
Any help is appreciated.
Mike