in reply to Divisors for a number

What could be helpful for you is the modulus operator as explained in http://perldoc.perl.org/5.8.9/perlop.html#Multiplicative-Operators. $n % $p equals zero if $p is a divisor of $n.

Replies are listed 'Best First'.
Re^2: Divisors for a number
by hdb (Monsignor) on Mar 03, 2015 at 15:08 UTC

    How about some golf?

    ($%%$_)||print$_.$/for 1..($%=shift)
      > How about some golf?

      more obfuscation than golf. :)

      Beside the cryptic variable-name, is the first paren not needed and you can use say to shorten print.

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)

      PS: Je suis Charlie!