in reply to Length of float using printf
will always produce a string of 4 characters, padded with spaces if shorter$out = pack "A4", $string;
will break off a string after 4 characters, and remove trailing spaces. (Bytes, actually...)$out = unpack "A4", $string;
The easiest approach, cutting off a substring of at most 4 characters (yes, characters).$out = substr $string, 0, 4;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Length of float using printf
by ikegami (Patriarch) on Jun 02, 2009 at 18:43 UTC | |
by vinaynp (Initiate) on Jun 02, 2009 at 19:10 UTC | |
|
Re^2: Length of float using printf
by vinaynp (Initiate) on Jun 02, 2009 at 18:42 UTC | |
by ikegami (Patriarch) on Jun 02, 2009 at 18:47 UTC |