I’m trying to split an HTML document into its head and body:
my @contentsArray = split( /<\/head>/is, $fileContents, 1);
if( scalar @contentsArray == 2 ){
$bodyContents = $dbh->quote(trim($contentsArray[1]));
$headContents = $dbh->quote(trim($contentsArray[0]) . "</head>");
}
is what i have. $fileContents contains the HTML code. When I run this, it doesn’t split. Any one know why?
sorry, figured it out. Thought the 1 was how many times it would find the expression not limit the results. Changed to 2 and works.