- 論壇徽章:
- 0
|
$ perl yuama.pl
("A" "Input")
("Y" "Output")
("HG" "Inout" "Ground")
("HV" "Inout" "Power")
he@he-THINK ~/manson/Image
$ cat yuama.pl
#!perl
my $str = '*.PININFO A:I Y:O HG:B HV:B';
my @array = split /\s+/, $str;
my %hash = (
B => 'Inout',
I => 'Input',
O => 'Output',
HV => 'Power',
HG => 'Ground',
);
foreach (@array) {
my @tmp;
my $rc;
next if /PININFO/;
@tmp = split /:/, $_;
$rc = "\"$tmp[0]\"" . ' ' . "\"$hash{$tmp[1]}\"";
if($tmp[1] eq 'B') {
$rc = $rc . ' ' . "\"$hash{$tmp[0]}\"";
} else {
}
print "($rc)\n";
}
|
|