Leser: 22
1
2
3
4
5
6
sub data{
my @parts;
print @_;
@parts = split( /:/, @_);
print "\n" . 'size of parts: ' . $#parts . "\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
31
32
33
34
Vendor: Phoenix Technologies, LTD
Version: 6.00 PG
Release Date: 10/08/2008
Address: 0xE0000
Runtime Size: 128 kB
ROM Size: 1024 kB
Characteristics:
ISA is supported
PCI is supported
PNP is supported
APM is supported
BIOS is upgradeable
BIOS shadowing is allowed
Boot from CD is supported
Selectable boot is supported
BIOS ROM is socketed
EDD is supported
5.25"/360 KB floppy services are supported (int 13h)
5.25"/1.2 MB floppy services are supported (int 13h)
3.5"/720 KB floppy services are supported (int 13h)
3.5"/2.88 MB floppy services are supported (int 13h)
Print screen service is supported (int 5h)
8042 keyboard services are supported (int 9h)
Serial services are supported (int 14h)
Printer services are supported (int 17h)
CGA/mono video services are supported (int 10h)
ACPI is supported
USB legacy is supported
LS-120 boot is supported
ATAPI Zip drive boot is supported
BIOS boot specification is supported
Handle
size of parts: 0
2011-02-17T15:27:04 payxwird der Sub eine Liste oder ein einziger Wert übergeben?
2011-02-17T15:27:04 payxWenn zweiteres, ist das, was Du splitten willst, der erste Wert in @_, also $_[0]. Typischerweise übernimmt man den mit einem Konstrukt wie my $param = shift;
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
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/perl
use strict;
use warnings;
my @handle;
# line number
my $c = 0;
my $line;
my $first = 0;
my $sep = $/;
my @parts;
open DMI, 'dmi' or die $!;
# dispose first four lines
$. = 0;
while ( $. <= 4 ){
$line = <DMI>;
}
# Start actual parsing
$/ = 'Handle';
while( <DMI> ){
$c++;
unless ( $first ){
$first = 1;
next;
}
parse($_);
exit;
}
# parses the handle multi line values
sub parse{
my @parts;
my $line;
@parts = split("\n", $_, 3);
dmi($parts[0]);
name($parts[1]);
data($parts[2]);
}
sub data{
my @parts;
#print @_;
@parts = split( /:/, $_[0]);
print "\n" . 'size of parts: ' . $#parts . "\n";
}
sub dmi{
return 0;
}
sub name{
return 0;
}