#!/usr/bin/env perl use warnings; use strict; use Data::Dumper; my $file="MySpace.html"; my $cmdString = "/tmp/"; chdir($cmdString)|| die "Error: could not '$cmdString'"; if (-e $file) #if the file exists { $cmdString="rm $file"; system($cmdString)==0 or die "Error: could not '$cmdString'"; } open(my $FILE, ">>$file") or die "Cannot open $file: $!"; ## >> means append to the end of file. my $fontColor="D2L"; my $empNo=43432; my $empName="Marconi"; my $empDesg="Managed Director"; my $empSal="59999.99"; print $FILE "\n"; print $FILE "\n"; print $FILE "\n"; print $FILE "\n"; If ( $empDesg == "Managing Director") { $fontColor="W30L"; } print $FILE "
HelloWorld
Emp#NameDesignationSalary
$empNo$empName$empDesg$empSal
\n"; print $FILE "

\n"; print $FILE "\n"; close($FILE); print "Your html has been created";