in reply to Re: Head comments parsing
in thread Head comments parsing

Ok... See i know how to parse te header... But i only want the top of the file being parsed!!!

eg for perl:
#!/usr/bin/perl -w # # Comment's about the file ... # ########################################### # Need this ... use strict;
IMHO opninion it can't be safely done because there is now way every comment structure is the same...



--
My opinions may have changed,
but not the fact that I am right

Replies are listed 'Best First'.
Re: Re: Re: Head comments parsing
by davorg (Chancellor) on May 18, 2001 at 15:23 UTC
    # Assume that the header is all the first block of commented # lines and that the first non-comment line ends the # header block while (<OLDFILE>) { last unless is_comment($filetype, $_); } # Print new header to new file print NEWFILE new_header($filetype); # Print the rest of the file while (<OLDFILE>) { print NEWFILE $_; }
    --
    <http://www.dave.org.uk>

    "Perl makes the fun jobs fun
    and the boring jobs bearable" - me