I am very new to Perl and am currently just following along a youtube tutorial guide (https://www.youtube.com/watch?v=WEghIXs8F6c). First he explains the syntax for printing varibles using print and then at roughly 8:50 in the video he explains how there's another method to printing called "say". However at this point when I try to run this code altogether I get the following pop up message:

Hello World! Can't use string ("curt lives on "123 main st" ") as a symbol ref while "strict refs" in use at Hello_world.pl line 21 (#1) (F) Only hard references are allowed by "strict refs". Symbolic references are disallowed. See perlref. Uncaught exception from user code: Can't use string ("curt lives on "123 main st" ") as a symbol ref while "strict refs" in use at Hello_world.pl line 21. at Hello_world.pl line 21 Press any key to continue . . .

to preface, this is the line of code I have used so far:

#!/usr/bin/perl

use strict;
use warnings;
use diagnostics;
use feature 'say';
use feature "switch";
use v5.12.3;
print " Hello World!\n";
my $name = 'curt';
my ($age, $street) = (40, '123 main st');
my $my_info = "$name lives on \"$street\"\n";
print $my_info
my $bunch_of_info = <<"END";
This is 
a lot of information
for different lines
END
say $bunch_of_info

I appreciate any and all help. Thankyou very much in advance.

2

There are 2 best solutions below

0
On

You have

print $my_info
my $bunch_of_info = ...;

The missing semi-colon means $my_info is expected to be a file handle.

print $fh ...;

A file handle can be a reference to a glob that contains a file handle. The string 123 main st is technically a valid reference, except when strictures (specifically strict refs) are enabled. And thus, you get the error you got.

4
On

Please see corrected code and compare with your code

#!/usr/bin/env perl

use strict;
use warnings;
use diagnostics;
use feature 'say';
use feature "switch";
use v5.12.3;

print " Hello World!\n";

my $name = 'curt';
my ($age, $street) = (40, '123 main st');
my $my_info = "$name lives on \"$street\"\n";

print $my_info;

my $bunch_of_info = <<"END";
This is
a lot of information
for different lines
END

say $bunch_of_info;

Output

 Hello World!
curt lives on "123 main st"
This is
a lot of information
for different lines