Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re^2: Bitwise Operator Error

by ravishi (Acolyte)
on Oct 03, 2008 at 13:35 UTC ( #715193=note: print w/replies, xml ) Need Help??

in reply to Re: Bitwise Operator Error
in thread Bitwise Operator Error

Thanks, that worked. However, this is just a sample code. I tried using bigint in my main program and it gives me a whole slew of new errors. It is a GUI program using Tk and a few Tk modules (Tk::TableMatrix, Tk::Balloon, Tk::Bitmap, and Tk::Pane). I'm guessing that bigint and the Tk modules conflict. These are two separate errors I get when I run it with bigint. The second I get when I comment out the first error.
C:\code> -trace out.PipeTracer.xml '8┬├⌐☻♥' isn't numeric at C:/Perl/site/ +lib/Tk/ line 205. at C:\code\ line 387 C:\code> -trace out.PipeTracer.xml trace_file = out.PipeTracer.xml Ports to be Analyzed: 1 2 'h┬├⌐☻♥' isn't numeric at C:/Perl/site/ +lib/ line 250. at C:\code\ line 159
Here is my code for the lines the errors point to. First is 387 and the second is 159.

Line 387:

my $cycleAccept = $statusBar->Button(-text => "Go to", -font => ['Arial', 8], -command=> \&GoToCycle, -bd => 1, -takefocus => 'never', -highlightthickness => 0)->pack( +-side => 'left');

Line 159:

$PortFrame = $allPortsFrame->Scrolled('TableMatrix', -resizeborders=>'none', -titlerows => 1, -titlecols => 1, -background => 'white', -foreground => 'white', -borderwidth => 0, -rows => 6, -colstretchmode=>'all', -cols => 1, -colwidth => 25, -cache => 1, -scrollbars => "osoe")->pa +ckAdjust(-side => "top", + -fill => 'both', + -expand => 1);

Replies are listed 'Best First'.
Re^3: Bitwise Operator Error
by ikegami (Pope) on Oct 03, 2008 at 19:53 UTC
    bigint basically turns every number into an object which acts as a number. Limit the scope of bigint using curlies, or create the objects yourself were needed.
    #!/usr/bin/perl -w # File { # Only makes objects from numbers in these curlies use bigint; my $testString = " 00008008 000000FF 00800000"; $testString =~ s/\s+//g; $testString = Math::BigInt->new("0x$testString"); my $maskResult = $testString & 0x400000000000000000000000; print "Mask Result: $maskResult\n"; }
    #!/usr/bin/perl -w # File my $testString = " 00008008 000000FF 00800000"; $testString =~ s/\s+//g; $testString = Math::BigInt->new("0x$testString"); my $mask = Math::BigInt->new('0x400000000000000000000000'); my $maskResult = $testString & $mask; print "Mask Result: $maskResult\n";

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://715193]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2018-01-20 16:04 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (227 votes). Check out past polls.