kaki has asked for the wisdom of the Perl Monks concerning the following question:

Hi guys, im trying to open the plain.html output in internet explorer, but the code below does not work for me. pls help.
sub gethtml{ open(FH, ">/home/GUAN/Data/plain.html"); close (FH); }

Replies are listed 'Best First'.
Re: Output as html on internet explorer
by taint (Chaplain) on Jun 03, 2014 at 06:23 UTC
    Greetings, kaki.

    Please wrap your code snippets within a
    <code> </code> block. Also of possible interest to you;

    Does your script contain:

    use strict; use warnings;
    ???

    Please also see: How do I post a question effectively?, if you have any other questions regarding the proper format of a question. Or it's markup.

    Best wishes.

    --Chris

    ¡λɐp ʇɑəɹ⅁ ɐ əʌɐɥ puɐ ʻꜱdləɥ ꜱᴉɥʇ ədoH

Re: Output as html on internet explorer
by Discipulus (Canon) on Jun 03, 2014 at 07:28 UTC
    I dunno if I have understood the question...
    you are writing to a file served by some webserver? you want to open it locally? is the content wrote to the file?

    In any case i strongly suggest the use of GetOpt::Long to parse @ARGVS

    In the future put some effort in writing a fully understandable question.

    HtH
    L*
    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
      sorry for that, because i don't really what i supposed to do, very confusing now -_-
Re: Output as html on internet explorer
by kaki (Initiate) on Jun 03, 2014 at 06:34 UTC
    .below is what all i have done.
    #!/usr/bin/perl -w use warnings; use strict; use cwd; our $input=""; our $web=""; our $help=""; our $version=""; our $path=""; foreach my $input(@ARGV){ if($input =~ m/\-d(.*)/) { $path=$1; } elsif($input =~ m/\-f(.*)/) { if($1 eq "h") { $web = "h"; } elsif($1 eq "t") { $web = "t"; } } elsif($input =~ m/\-h/ ){ $help = "h"; } elsif($input =~ m/\-s(.*)/) { if($1 eq "a") { $web = "a"; } elsif($1 eq "d") { $web = "d"; } } elsif($input =~ m/\-v/ ){ $version = "v"; } } #calling of methods if($web eq "h") { gethtml(); } if($web eq "t") { gettext(); } if($help eq "h") { gethelp(); } if($version eq "v") { getversion(); } if($web eq "a") { sortedasc(); } if($web eq "d") { sorteddesc(); } #methods sub gethtml{ open(FH, ">plain.html"); print "sasasasas"; close (FH); } sub gettext{ open(FH1, "/home/GUAN/Data/output.txt") or die "Error, no such fil +e found"; print <FH1>; close (FH1); } sub getdefault{ open(FH1, "/home/GUAN/Data/output.txt") or die "Error, no such fil +e found"; print <FH1>; close (FH1); } sub sorteddesc{ open(FH1, "/home/GUAN/Data/output.txt") or die "Error, no such fil +e found"; print sort{ $b cmp $a } <FH1>; close (FH1); } sub sortedasc{ open(FH1, "/home/GUAN/Data/output.txt") or die "Error, no such fil +e found"; print sort{ $a cmp $b } <FH1>; close (FH1); } sub gethelp { print "Usage: {file name} [switches] &#8208;dpath directory to search for html files (default: .) &#8208;f[th] output in text or html mode (default: text) &#8208;h print this message and exit &#8208;s[adn] sort in ascending, descending or none (default: none) &#8208;v print version and exit"; } sub getversion { print "*************************************************************** +********\n ST2614 Assignment 1, Ver. 5.0 done by Guan Zhimin p1333114 class 2A/01 +\n ********************************************************************** +*"; } # sub lookfor { # my $dir = '.'; # opendir(DIR, $dir) or die $!; # while (my $file = readdir(DIR)) { # next if ($file =~ m/^\./); # print "$file\n"; # } # closedir(DIR); # exit 0; # }
        so i think it is use Cwd; , not i don't want to use other modules, but my assignment only allows me to use that 3 modules. right now i having problem to make assignment1.pl -fh to be able to redirected into a file and view from the web browser.