I am looking to right justify ONLY the totalQty field in below script. How do I accomplish this?

open(CUSTORDS, ">\\\\bcedi\\d\$\\dsdata\\rp\\lby\\custords.dat")||die +"Can't open file"; while ( my @row = $sth->fetchrow_array() ) { $lineStatus = $row[0]; $style = $row[1]; $colorCode = $row[2]; $lblCode = $row[3]; $totalQty = $row[4]; $startDate = $row[5]; $orderType = $row[6]; $orderNum = $row[7]; $orderStatus = $row[8]; $confType = $row[9]; $poNum = $row[10]; $customer = $row[11]; $sku = $style . $colorCode . ($space x (32 - length($style . $colorCod +e))); $company = $space x 3; $division = $space x 8; $corp = $space x 12; $sold = $space x 8; $dept = $space x 3; $shipTo = $space x 12; $totalQty = $totalQty . ($space x (8 - length($totalQty))); $poNum = $poNum . ($space x (13 - length($poNum))); $customer = $customer . ($space x (8 - length($customer))); $remarks = $space x 30; $orderStatus = $orderStatus . ($space x (4 - length($orderStatus))); $year = substr($startDate,0,4); $month = substr($startDate,5,2); $day = substr($startDate,8,2); $startDate = $year . $month . $day; $poNum = substr($poNum,0,13); print CUSTORDS "$sku$company$division$corp$sold$dept$shipTo$totalQty$s +pace$poNum$customer$remarks$orderStatus$startDate\n";

In reply to right justify by brpower

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.