On 08/18/2018 11:32 PM, Dave Cross wrote:
On Fri, 17 Aug 2018 at 19:10, ToddAndMargo <ToddAndMargo@xxxxxxxx> wrote:
Hi All,
I am not find Perl 5's "say" in
https://ewr.edge.kernel.org/fedora-buffet/fedora/linux/releases/28/Everything/x86_64/os/Packages/p/
# dnf list perl-say*
Last metadata expiration check: 0:09:13 ago on Fri 17 Aug 2018 09:58:26
AM PDT.
Error: No matching Packages to list
# perl -Msay -e 'say "Hi";'
Can't locate say.pm in @INC (you may need to install the say module)
(@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5
/usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl
/usr/lib64/perl5 /usr/share/perl5).
BEGIN failed--compilation aborted.
And I tried downloading it from cpan and it won't install.
What am I missing?
I know you have a solution, but I thought it was worth explaining
exactly what is going on here.
The 'say' function is not in an external module. It is a part of the
core Perl language. When 'say' was added to Perl (in version 5.10) it
was decided that too many people might already have a subroutine
called 'say()' in their code, so it wasn't turned on by default.
There are a few ways to turn on support for 'say' in your Perl program.
1/ Explicitly with the 'feature' pragma (see "perldoc feature" for
more details).
use feature 'say';
say 'Hello';
2/ By requiring a version 5.10 or greater of Perl (which turns on all
of the features for the version of Perl you have asked for).
use 5.010;
say 'hello';
3/ You can use the -M command line argument to simulate the 'use
feature' approach.
perl -Mfeature=say -e'say "hello"'
4/ But using -E instead of -e will turn on all features for your
current version of Perl.
perl -E'say "hello"'
Wonderful explanation. Thank you!
I mainly use Perl 6 now. But I do still have two Perl 5
programs to maintain.
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx/message/ZF6TDNHHZUMTCLIFU3MH2ENTQQFKQWHB/