in reply to Script to convert HBA WWNs to lowercase and add ":"[Updated]
IMO, your script would be more useful if it included some input validation. After the line:
chomp ($wwn=<STDIN>);I would suggest adding:
die "Input must be 16 characters\n" unless 16 == length $wwn; die "Invalid hex digit '$1'\n" if $wwn =~ /([^[:xdigit:]])/;
Update: changed allowed input length from 10 (where did I get that number from?) to 16, as per WWN spec.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Script to convert HBA WWNs to lowercase and add ":"
by perl514 (Pilgrim) on Dec 28, 2011 at 17:58 UTC |
In Section
Cool Uses for Perl