Thread Saubere Perl-Syntax Variable in sub behalten
(19 answers)
Opened by bianca at 2014-09-16 08:07 2014-09-16T07:36:53 Muffi 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 |