How do i print a series values using the print statement in perl?



  • The perl print statement can be separated using commas to print a number things.

    print "$str", 5 * 5, ".\n"
    

    Will print the $str string, the result of 5 * 5, followed by a period and newline.

    #!/usr/bin/env perl
    $str = "Toast";
    $str .= " ";
    print "$str", 5 * 5, ".\n"
    

    Result:
    Toast 25.


Log in to reply
 

© Lightnetics 2024