> "SR" == Sayth Renshaw writes:
>> Uri Guttman -- u...@stemsystems.com
http://www.sysarch.com --
>> - Perl Code Review , Architecture, Development, Training, Support
--
>> - Gourmet Hot Cocoa Mix http://bestfriendscocoa.com
-
>>
p
On Tue, May 31, 2011 at 3:45 PM, Uri Guttman wrote:
>> "SR" == Sayth Renshaw writes:
>
> SR> my $hex = sprintf("ox%o2x\n", $number);
>
> why is the \n there? you just chomp it off. better to not put it in the
> string to begin with.
>
> also that leading char is the letter 'o' which is not t
> "SR" == Sayth Renshaw writes:
SR> my $hex = sprintf("ox%o2x\n", $number);
why is the \n there? you just chomp it off. better to not put it in the
string to begin with.
also that leading char is the letter 'o' which is not the way octal
numbers are represented. they start with just a zer
On Tue, May 31, 2011 at 3:24 PM, Michael Greb wrote:
> On Tue, May 31, 2011 at 02:27:53PM +1000, Sayth Renshaw wrote:
>> This there formula $oct_perm_str = sprintf "%o", $perms;
>> However it is not working for me. I have used my $oct = sprintf "%0",
>> $number;
>
> You want '%o', the lower case
On Tue, May 31, 2011 at 02:27:53PM +1000, Sayth Renshaw wrote:
> This there formula $oct_perm_str = sprintf "%o", $perms;
> However it is not working for me. I have used my $oct = sprintf "%0", $number;
You want '%o', the lower case letter o for the sprintf format string,
the sample code you showe
On Tue, May 31, 2011 at 12:27 AM, Sayth Renshaw wrote:
> Invalid conversion in sprintf: "%0" at hexToOctal.plx line 11, line 1.
*snip*
> my $oct = sprintf "%0", $number;
I think that you meant %O (or maybe %o; but not %0).
> my $hex = printf("0x%02x\n", $number);
I think that you meant sprintf
Hi
I am on my way to learning perl, and am reading the beginning perl
book. In chapter 2 I am following the exercises
(http://docs.google.com/viewer?url=http%3A%2F%2Fblob.perl.org%2Fbooks%2Fbeginning-perl%2F3145_Chap02.pdf),
question 2 asks for a hex converter. As fun, I thought it would be
useful