Leser: 19
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/Perl/bin/perl
use strict;
use warnings;
my $task = $ARGV[0];
my $input = $ARGV[1];
if( $task eq 'filename' ) {
my ($oxartnum) = $input =~ m~.+\\([^\\]+).html~;
$ENV{current_oxartnum} = $oxartnum;
print "set oxartnum to $oxartnum\n";
}else{
my $oxartnum = $ENV{current_oxartnum};
print "new segment: <$oxartnum, $input>\n";
}
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
#!/Perl/bin/perl
use strict;
use warnings;
use Storable qw(store retrieve);
=comment
Store a value:
>perl ser.pl store stored_value
set stored value to stored_value
Retrieve stored value:
>perl ser.pl other_task some_value
other_task: <stored_value, some_value>
=cut
my $task = $ARGV[0];
my $input = $ARGV[1];
if( $task eq 'store' ) {
store( {number => $input}, 'store.txt' );
print "set stored value to $input\n";
}else{
my $ref = retrieve('store.txt');
my $number = $ref->{number};
print "$task: <$number, $input>\n";
}