Thread Saubere Perl-Syntax Variable in sub behalten (19 answers)
Opened by bianca at 2014-09-16 08:07

bianca
 2014-09-16 09:48
#177306 #177306
User since
2009-09-13
6975 Artikel
BenutzerIn

user image
2014-09-16T07:36:53 Muffi
wenn du das debug nicht brauchst müsst auch eine direkte Zuweisung gehn.

Ja, das ist gut!!
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/perl
use strict;
use warnings;
use Crypt::CBC;
use feature 'state';

my $crypt = sub {
    state $c = Crypt::CBC->new(
        -key    => 'foobar',
        -cipher => 'Blowfish',
    );
    $_[0] = '' if !defined $_[0];
    return $c->encrypt($_[0]);
};

print $crypt->('foo')."\n";
print $crypt->('bar')."\n";
print $crypt->('')."\n";
print $crypt->()."\n";
10 print "Hallo"
20 goto 10

View full thread Saubere Perl-Syntax Variable in sub behalten