Been trying to figure out why this code is not storing my sprintf output. Please help! Thx!!!
use strict; use warnings; $lsmapFH = new FileHandle "/usr/ios/cli/ioscli lsmap -vadapter $option +s[4] |" or die $!; while (<$lsmapFH>) { if (/no virtual device found/i) { warn "\n\nThis vhost $options[4] has no clients using me, tr +y again with a correct vhost #!\n\n"; die $!; } chomp; $vh = (split)[0] if /^vhost/i; $clid = (split)[2] if /^vhost/i; $cltid = sprintf "%d", $clid; } $lsmapHash{$vh} = { 'clientID' => $cltid, }; } use Data::Dumper; print Dumper \%lsmapHash; $VAR1 = { 'vhost10' => { 'clientID' => '0' } works fine in CLI: # perl -le '$clid=0x0000000a; $cltid= sprintf "%d", $clid; print $clti +d;' 10 __SAMPLE_OUTPUT__ from lsmap SVSA Physloc Client Pa +rtition ID --------------- -------------------------------------------- --------- +--------- vhost10 U9117.MMD.218A8B7-V1-C2 0x0000000b VTD vtscsi25 Status Available LUN 0x8100000000000000 Backing device l02duapXXXX_r1.58ff94782d7c325acc49a8dd9c04bb1e Physloc Mirrored N/A VTD vtscsi26 Status Available LUN 0x8200000000000000 Backing device l02duapofdev_b1.0ee86903d4951ce38a9b691b322ff1d2 Physloc Mirrored N/A

In reply to sprintf to hash by teamassociated

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.