i'm working on a script in perl.
This script read a DB and generate config file for other devices.
I have a problem with "0".
From my database, i get a 0 (int) and i want this 0 become a "0" in the config file. When i get any other value (1,2,3, etc), the script generate ("1","2","3", etc). But the 0 become an empty string "".
I know, for perl:
- undef
- 0
- ""
- "0"
are false.
How can i convert a 0 to "0" ? I try qw,qq,sprintf, $x = $x || 0, and many many more solutions.
I juste want to make a explicit conversion instead of an implicite conversion.
Thank you for your help.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…