> That's one way to pass the file content to a script via the STDIN filehandle.
> A shorter way is to pass the filename to the script:
>
> $ ./myscript file.html
>
> Try out this code:
>
> #!/usr/bin/perl
> use strict;
> use warnings;
>
> open my $fh, $ARGV[0] or die "can't open passed file '$ARGV[0]': $!";
>
> local $/; # to slurp the file at once
> my $joined=<$fh>;
>
> print $joined;
>
> # end of script
> Here is some untested code: may do the expected or not :-)
>
> ($joined)=~$joined=~m,(<BODY>.*?</BODY>),is or die "no body";
> $joined=~s,<(?:SPAN|FONT)[^>]*?>,,igs;
> $joined=~s,STYLE\s*=\s*(["']).*?\1,,igs;

thanks!!

slurp mode is great thing ;)

this works!
--------------------
#!/usr/bin/perl

local $/; # to slurp the file at once
my $joined=<>;
$joined=~s/.*?<BODY[^>]*?>//is;
$joined=~s/<\/BODY.*?>.*//is;
$joined=~s/<\/?(?:SPAN|FONT)[^>]*?>//igs;
$joined=~s/ (?:(STYLE|CLASS|LANG)\s*=\s*(["']).*?\1//igs;
print $joined;
---------------------
 this is the way to convert doc to html: first, from doc to html by
OpenOffice (much better, than MS Word), then by this script -
beautiful html :)
PS
 What '\s*=\s*(["']).*?\1' mean?

Great thanks!
Altshuler Eugeny

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to