- Perl ›
- Operators ›
- Arithmetic operator ›
- here
Exponentiation operator - **
Use the exponentiation operator "**" to find the exponentiation.
my $two_power_num = 4 ** 2;
Use the ** operator to find the power. Exponentiation is an operation that multiplies the same number multiple times.
Example program
This is an example program to find the power.
use strict; use warnings; # Find a power. print "1: Find the power.\n"; my $num = 4; my $two_power_num = 4 ** 2; print "The square of $num is $two_power_num.\n";