The $n goes w/ %d and then the the test ( $n == 1) ? "" : "s" says 'ties' (
can't think of the right words) either "" if $n is one or an "s" w/ %s. You
need to look at the format info regarding printf. In this context %s is a
string format with no specified length and has nothing to do with a hash.
Wags ;)
-----Original Message-----
From: Jimmy S. Lim [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 26, 2000 17:57
To: Perl-Win32-Users Mailing List
Subject: Understanding perlop
hi,
i came across this statement while reading Perlop. I don't understand how %s
is substituted w/ "s" or w/o "s" depending on the no. of dogs. %s is a hash.
how is it associated w/ the ?: operator?
it prints " i have 0 dogs." but if i change 1 to 0, it prints "i have 0
dog."
grateful for your time.
printf "I have %d dog%s.\n", $n,
($n == 1) ? '' : "s";
---
You are currently subscribed to perl-win32-users as:
[EMAIL PROTECTED]
To unsubscribe, forward this message to
[EMAIL PROTECTED]
For non-automated Mailing List support, send email to
[EMAIL PROTECTED]
---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
[EMAIL PROTECTED]
For non-automated Mailing List support, send email to
[EMAIL PROTECTED]