ansi-console.pl to HTML.

index -|- end

Generated: Sat Oct 24 16:35:09 2020 from ansi-console.pl 2020/05/18 1.3 KB. text copy

#!/perl -w
# NAME: ansi-console.pl
# AIM: Display some color, using Win32::Console::ANSI;
use strict;
use warnings;
use Win32::Console::ANSI;
#use Term::ANSIColor;
my $os = $^O;
my $perl_dir = '/home/geoff/bin';
my $PATH_SEP = '/';
my $temp_dir = '/tmp';
if ($os =~ /win/i) {
    $perl_dir = 'C:\GTools\perl';
    $temp_dir = $perl_dir;
    $PATH_SEP = "\\";
}
unshift(@INC, $perl_dir);

require 'logfile.pl' or die "Unable to load logfile.pl ...\n";
# log file stuff
my ($LF);
my $pgmname = $0;
if ($pgmname =~ /\w{1}:\\.*/) {
    my @tmpsp = split(/\\/,$pgmname);
    $pgmname = $tmpsp[-1];
}
my $outfile = "temp.$pgmname.txt";
open_log($outfile);
prt( "$0 ... Hello, World ...\n" );

my @array1 = ();
my @array2 = ();
my $colr1 = "\033[36;1m";
my $colrn = "\033[m";

fill_arrays( \@array1, \@array2 );
list_array( \@array1 );
list_array( \@array2 );

close_log($outfile,0);
exit(0);


sub list_array {
    my ($ar) = shift;

    foreach my $val (@$ar) {
        prt( "$colr1$val$colrn\n" );
    }
}

sub fill_arrays {
    my ($ar1, $ar2) = @_;

    push(@$ar1, "one");
    push(@$ar1, "two");
    push(@$ar1, "three");
    push(@$ar1, "four");

    push(@$ar2, "2one");
    push(@$ar2, "2two");
    push(@$ar2, "2three");
    push(@$ar2, "2four");

}

# eof

index -|- top

checked by tidy  Valid HTML 4.01 Transitional