Als Beispiel.... :-)
Skript:
use HelloWorld;
my $greeting = HelloWorld->new();
$greeting->set('text', 'Hello World');
$greeting->say($greeting->get('text'));
HelloWorld.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package HelloWorld;
use strict;
use warnings;
use lib qw(.);
use Greetings ($0);
use String;
#Erzeugen
sub new {
my ($class,@params) = @_;
my $self = {};
bless($self,$class);
return($self);
}
sub set
{
my ($self,$var, $value ) = @_;
$self->{$var} = $value;
}
sub get
{
my ($self,$var) = @_;
return $self->{$var};
}
sub say
{
my ($self,$value) = @_;
print $value;
}
#alternativ
sub say2
{
my ($self,$value) = @_;
print $self->{text};
}
\n\n
<!--EDIT|master|1144857956-->
$i='re5tsFam ^l\rep';$i=~s/[^a-z| ]//g;$\= reverse "\U!$i";print;