w**2 发帖数: 724 | 1 【 以下文字转载自 Programming 讨论区 】
发信人: wds2 (阿旺), 信区: Programming
标 题: perl sprintf question converting dec to hex
发信站: BBS 未名空间站 (Wed Mar 4 17:42:19 2015, 美东)
hi i have this line,
$MACAddress = sprintf("%06x", $MACAddress);
1. when $MACAddress was -1, this line converts it to ffffffffffffffff
instead of ffffffff, i'm on a 32-bit linux pc.
why ?
2. in my code, i need to write $MACAddress twice.
how to use some shortcut e.g. $1 ?
Thanks !
BTW, i LOVE Perl, :) |
|