Hello mgatto, and welcome to the Monastery!

From the information given, I cannot reproduce your problem:

#! perl use strict; use warnings; use bigint; use List::Util qw( max ); use Data::Dumper; my @result = prime_factors(600_851_475_143); #print Dumper \@result; print max @result; sub prime_factors { my ($number) = @_; my $divisor = 2; my @factors; while ($number > 1) { if (($number % $divisor) == 0) { push @factors, $divisor; $number /= $divisor; } elsif ($divisor == 2) { ++$divisor; } else { $divisor += 2; } } return @factors; }

Output:

12:58 >perl 609_SoPW.pl 6857 13:00 >

However, the problem you are seeing may be related to the problem I experienced recently with bignum and the range operator: see Strange interaction of bigint and foreach.

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,


In reply to Re: List::Util can't find max in array of BigInts by Athanasius
in thread List::Utils can't find max in array of BigInts by mgatto

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.