Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

eghdam,

Why make it so complicated ( however it is your script :-)

############# UNTESTED ################ use strict; my $pvid = ''; # initialize my @output = `command`; # Output looks like 7 lines and on [one] li +ne is the pvid: # pvid 00c1be9a467335ce0000000000000000 # I use qx/command/; # easier to see in cod +e for me! foreach my $line ( @output ) { # print "$line\n"; ## If not working, use print to figure out w +hat's happening if ( substr( $line, 0, 5 ) eq 'pvid ' ) { $pvid = substr( $line, 6, 16 ) # or '32' as you require last; } } if ( $pvid eq '' ) { ... } ## Generate warning or do some error h +andling!

I'm coding to my style, but you are free to chose what works for you. But remember if you have to go back to the code and update, make it as easy to understand as possible. Don't spend 2 hours figuring out what you did and then make a 2 line update.

Good Luck...Ed

"Well done is better than well said." - Benjamin Franklin


In reply to Re^3: remove 16 Zeros by flexvault
in thread remove 16 Zeros by eghdam

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-25 23:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found