I didn't know about YAPE. Nifty module. Thanks Corion, always seem to stumble into something new from reading your posts =)
hector89, be sure to take some time to understand the code in all these replies it will help you write your own solution next time!
This should do what you want:
open my $input_fh, '<', 'your_input.aspx';
my $delim = $/;
$/ = '';
my $file = <$input_fh>;
$/ = $delim;
$file =~ s/(<%--)?\s*<script(.*?)>/($1 ? '' : "\n<%-- ") . "<script$2>
$file =~ s=</script>\s*(-->)?='</script>' . ($1 ? '' : " -->\n")=ige;
open my $output_fh, '>', 'your_output.aspx';
print $output_fh $file;
Forgot to turn off greedy matching for the script attributes group in my first post, which might be why you were having issues with input that's all on one line.
Strange things are afoot at the Circle-K.