Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do I say this without the qw?

25 views
Skip to first unread message

T

unread,
Jul 28, 2015, 4:12:51 AM7/28/15
to
use Term::ReadKey qw (GetTerminalSize);


I am trying to learn both ways of doing it. I
won't go into the ways I have already tried that
did not work. :'(

Rainer Weikusat

unread,
Jul 28, 2015, 4:35:39 AM7/28/15
to
Arguments to import are a list of strings naming the symbols/ names to
be imported. Any list of strings will do. The following two scriptlets
behave identically,

--------
use POSIX qw(uname write);

my $sys = (uname())[0];
write(1, $sys."\n", length($sys) + 1);
--------

--------
use POSIX 'uname', 'write';

my $sys = (uname())[0];
write(1, $sys."\n", length($sys) + 1);
--------

--------
use POSIX 'uname';
use POSIX 'write';

my $sys = (uname())[0];
write(1, $sys."\n", length($sys) + 1);
--------






T

unread,
Jul 28, 2015, 4:39:44 AM7/28/15
to
Hi Rainer,

I forgot the stinkin' single quotes! [editorial
comment] AAAHHHHH!!!! [/editorial comment]

I am wiring down what you wrote me. Thank you for
helping me with this!

-T

Justin C

unread,
Jul 28, 2015, 7:12:05 AM7/28/15
to
On 2015-07-28, T <T...@invalid.invalid> wrote:
> use Term::ReadKey qw (GetTerminalSize);

GetTerminalSize is one of the standard exports, all you need is:
use Term::ReadKey;
my @termsize = GetTerminalSize();


> I am trying to learn both ways of doing it. I
> won't go into the ways I have already tried that
> did not work. :'(

The module docs should tell you if something is not on the default
export list and therefore needs the be named on the 'use' line.

Most modules will export the most commonly used subs and all you need
to do is 'use' the module to get them.


Justin.

--
Justin C, by the sea.

Jürgen Exner

unread,
Jul 28, 2015, 9:13:38 AM7/28/15
to
T <T...@invalid.invalid> wrote:
>use Term::ReadKey qw (GetTerminalSize);

The 2 obvious ways, I am sure others can come up with even more
use Term::ReadKey ("GetTerminalSize");
use Term::ReadKey ('GetTerminalSize');

Further details see perldoc perlop, section quote and quote-like
operators.

>I am trying to learn both ways of doing it.

Why 2? There are many more ways for not using qw. After all that's just
another of Perl's many syntactic sugars.

jue

T

unread,
Jul 28, 2015, 6:55:06 PM7/28/15
to
On 07/28/2015 06:13 AM, J�rgen Exner wrote:
> Why 2

The two that are easily readable to me
0 new messages