scratchpad
allolex
<code>
#!/usr/bin/perl
my $obj = new MyObject ('GB-LAQ-05-00017');
print $obj."\n";
package MyObject;
sub new {
my($pkg, $string) = @_;
bless {
_string => $string,
}, $pkg;
}
sub SCALAR {
$_[0]->{_string};
}
</code>
<h3>Filename conversion - make acronym</h3>
<code>
#!/usr/bin/perl
# Converts a long file name with spaces or underscores
# to an abbreviated format.
use strict;
my $filename = 'This is my word document there are many like it but this one is mine.doc';
my @array = split /[ \._]/, $filename;
my $ext = pop @array;
print map m/^([\w])/, @array;
print '.' . $ext . "\n";
</code>
:wq