Re: Where is Perl 5's "say" module?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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"'

-- 
Dave Cross :: dave@xxxxxxxxxxx
http://dave.org.uk/
@davorg
_______________________________________________
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/3KZWXUK3NWJVEFU4KOV6UADSQIZ443I2/



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux