rsriram has asked for the wisdom of the Perl Monks concerning the following question:
Hi, When I tried using sprintf to replace my search string, I am encountering a problem. My program line to replace is below
$_ =~ s/<xref t="n(\d+)"\/>/'<xref target="note-'.sprintf{"%02d",$1}.'"\/>'/egs;
But instead of getting the replaced string as a zero-filled two digit number, it displays HASH{x....}. Could anyone help me how to replace the searched string with zero filled number? Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using sprintf
by moritz (Cardinal) on Nov 25, 2008 at 07:49 UTC | |
|
Re: Using sprintf
by graff (Chancellor) on Nov 26, 2008 at 02:41 UTC |