in reply to strip out lines until match

$string =~ s/\A\s+@QUERY/@QUERY/
or
$string = substr($string, index($string, '@QUERY'));