#!/usr/bin/perl if (!($file=$ARGV[0])) { print "Usage: ssireduce \n"; exit 1; } # Grab in the entire file to $content open(HTML,$file) or die "Couldn't open $file for reading: $!\n"; $slash=$/; undef $/; $content=; close(HTML); $/=$slash; # Zap SSIs $content=~s/.*//sg; ($title)=($content=~m|(.*)|i); # Throw away everything between the title and the start of the 'real' # document. We may want to keep the META stuff at some point. $content=~s|(.*)||isg; $content=~s||$title|; if ($content=~//sg) { $content=~s/^.*\n//sg; } else { $content=~s/^(.*?)(.*)$//sg; $content=~s/\r//sg; open(OUT, "> $file") or die "Couldn't open $file for writing\n"; print OUT $content; close(OUT);