Formating Dollar sign in front of digits.

Posted on 2004-11-27
Last Modified: 2013-11-13
O.K. all you experts . . . .You guys are two for two.   Here's another studid question.   This is probably comman knowledge for you.   How do you format a dollar sign in front of a bunch of numbers?   Thanks for you help!
Question by:jmeyer34
    LVL 8

    Expert Comment

    What do you mean format?  What's your goal?  What language?


    Author Comment

    Oh, sorry . . .in Perl.   We are learning how to format  . . . .such as with %15s    . . .stuff like that.   Is this not part of formatting?   Is it as simple as just putting a dollor sign in front of my variable?
    LVL 2

    Accepted Solution

    did you try to put \$ in front of the string(numbers) ?

    Author Comment

    Thanks!   I put what you said in front of my formating symbols.    Such as
    printf "%-15s  \$10.2f  \$%8.2f\n\n", $employeename, $grosspay, $net_pay;    and it worked!   Thanks much!
    LVL 2

    Expert Comment

    happy that i could help
    for the future when you want to put a special char always put a \ before it ix if you want to put a \ in code you have to put \\


    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
    Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now