Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Script to convert HBA WWNs to lowercase and add ":"

by Not_a_Number (Parson)
on Dec 18, 2011 at 19:21 UTC ( #944193=note: print w/ replies, xml ) Need Help??


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.


Comment on Re: Script to convert HBA WWNs to lowercase and add ":"
Select or Download Code
Re^2: Script to convert HBA WWNs to lowercase and add ":"
by perl514 (Pilgrim) on Dec 28, 2011 at 17:58 UTC

    Hi Not_a_Number,

    I have put up an updated version of the script. Its got all the checks that you suggested and some more. :)

    Perlpetually Indebted To PerlMonks

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://944193]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2015-07-04 08:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (58 votes), past polls