Question #53626

Write the following expression using a shortcut:
$y = $y + 5;

Expert's answer

Question #53626, Programming, Perl, for completion

Write the following expression using a shortcut:

$y = \$y + 5$;

Answer:


$y += 5;


The original example with corrected syntax and formatting (for context):


$y = 0;
while (<>) {
    $y += 5;
    print "$y\t$_";
}
LATEST TUTORIALS
APPROVED BY CLIENTS