Thread Zähler - Variablen mit "001" (8 answers)
Opened by utang at 2004-04-22 23:11

betterworld
 2004-04-23 17:10
#81801 #81801
User since
2003-08-21
2614 Artikel
ModeratorIn

user image
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/perl -l
use strict;
use warnings;

{
  package Zaehler;
  use Tie::Scalar;
  use vars '@ISA';
  push @ISA, 'Tie::StdScalar';

  sub FETCH {
    my $self = shift;
    return sprintf('%03d', $$self);
  }
}

my $zaehler;
tie $zaehler, 'Zaehler', 8;

print $zaehler;
$zaehler ++;
print $zaehler;
\n\n

<!--EDIT|betterworld|1082725980-->

View full thread Zähler - Variablen mit "001"