Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3967870
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:46:20+00:00 2026-05-20T03:46:20+00:00

#!perl6 use v6; my $m = 70; my $n = 30; ( $m div

  • 0
#!perl6
use v6;

my $m = 70;
my $n = 30;

( $m div $n ).say;

The first examples works, but the second doesn’t. I suppose it’s because in the second example the variable-values are strings. If my guess is right, how could I change the string-variables to integer-variables?

#!perl6
use v6;

my $m = '70';
my $n = '30';

( $m div $n ).say;


# No applicable candidates found to dispatch to for 'infix:<div>'. 
# Available candidates are:
# :(Int $a, Int $b)

#   in main program body at line 7:./perl5.pl
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T03:46:21+00:00Added an answer on May 20, 2026 at 3:46 am

    You can always manually cast to Int

    ( $m.Int div $n.Int ).say;
    

    Actually I would have hoped that prefix:<+> would work as in

    ( +$m div +$n ).say;
    

    But it just “Num”ifies and the sig requires “Int”, I am not sure if it should be this way or not.

    UPDATE: +$m now works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone tell me, why the opendir doesn't work? #!/usr/bin/env perl6 use v6; my
When I use WWW::Mechanize::Cached with default values all works fine. #!/usr/bin/env perl use warnings;
I want to use a proxy with this perl script but I'm not sure
#!perl6 use v6; my $list = 'a' .. 'f'; sub my_function( $list ) {
Why do I get this error-message? #!perl6 use v6; my @a = 1..3; my
#!/usr/bin/env perl use warnings; use 5.012; use Inline 'C'; my $value = test(); say
I have this block of html: <div> <p>First, nested paragraph</p> </div> <p>First, non-nested paragraph.</p>
The following script works fine: #!/usr/bin/env perl use strict; use warnings; use Data::Dumper; use
!/usr/bin/env perl use warnings; use strict; my $text = 'hello ' x 30; printf
Consider: #!/usr/bin/perl use strict; use warnings; my %hash; foreach (1 .. 10) { $hash{$_}

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.