Generated: Tue Feb 2 17:54:52 2010 from package.pl 2010/01/29 714.
#!/usr/bin/perl -W # NAME: package.pl # AIM: Simple use of 'package' declaration use strict; use warnings; #################################### package Hexer; #################################### sub new { my($class) = @_; my $str = ""; bless \$str, $class; } sub toHex { my ($self,$str) = @_; my $len = length($str); my @a = unpack ("C$len", $str); my $s = ""; for (@a) { $s .= sprintf ("%02x ", $_); } $s; } ###################################### package main; ###################################### my $cc = "ABC \n"; my $a = new Hexer; my $hx = $a->toHex($cc); print "hex $hx\n"; ###################################### # eof - package.pl