in reply to Output as html on internet explorer

.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; # }

Replies are listed 'Best First'.
Re^2: Output as html on internet explorer
by Anonymous Monk on Jun 03, 2014 at 07:26 UTC
      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.