foreach $line (@file) { chop $line; if ($line =~ /^get (.+)$/) { push (@getrequest, $1); } if ($line =~ /^post (.+)$/) { $postrequest = $1; $dataread = "true"; } if ($dataread eq "true") { if ($line =~ /content-type: (.+)/) { $post{$postrequest}{content-type} = $1; if ($post{$postrequest}{content-type} =~ /; boundary=(.+)/) { $boundary = $1; } else { $boundary = ""; } } if ($line =~ /content-length: (.+)/) { $post{$postrequest}{content-length} = $1; } if ($line eq "" && $boundary = "") { $contentnextline = "true"; } if ($contentnextline eq "true") { $post{$postrequest}{content} = $line; $contentnextline = "false"; $dataread = "false"; } if ($line eq $boundary && $boundary ne "") { $content_flag = "true"; } if ($line eq $boundary && $content_flag eq "true") { $content_flag = "false"; $dataread = "false"; $post{$postrequest}{content} = \@content; } if ($content_flag eq "true") { push (@content, "$line\n"); } }