On Fri, 4 Aug 2017 at 08:47 Todd Chester <toddandma...@zoho.com
<mailto:toddandma...@zoho.com>> wrote:
Hi All,
In Linux, how do I things to a perl6 one liner?
I want to send
ip -o -f inet addr show | perl6 ***dig out the netmask on eno1***
I know how to dig out the net mask, I just don't how to pipe
to the command.
Many thanks,
-T
On 08/04/2017 02:06 AM, Simon Proctor wrote:
From the perl6 -h response you have the standard Perl command line
switches
-e program one line of program, strict is enabled by default
With this case $*IN|has the content from the pipe going into it.
Personally I combine -e with one of the next two
|
-n run program once for each line of input
In this case your command line is repeated with $_ set to the next line
of text from $*IN
-p same as -n, but also print $_ at the end of lines
And as it says, does the same as -n with an extra print. (Though from a
quick test it looks to be a say?)
Generally one of -e, -ne or -pe will cover what you want. -e if you need
to work with more than one line at a time. -ne if you don't want to
print all the things and -pe if you do (after modifications).
Simon
Hi Simon,
I am missing something. :-(
$ echo abc | perl6 -e 'say $*IN;'
IO::Handle<IO::Special.new(what => "<STDIN>")>(opened, at octet 0)
$ echo abc | perl6 -e 'say "$*IN";'
IO::Special.new(what => "<STDIN>")
-T