编程对我来说是如此新鲜,我为不知道如何表达问题而道歉.
我有一个Perl脚本从内部工具获取变量.这并不总是它看起来像,但它将始终遵循这种模式:
darren.local 1987 A Sentence1
darren.local 1996 C Sentence2
darren.local 1991 E Sentence3
darren.local 1954 G Sentence4
darren.local 1998 H Sentence5
Run Code Online (Sandbox Code Playgroud)
使用Perl,将每条线路变为变量的最简单方法是什么?根据内部工具吐出的内容,每条线总是不同的,并且可以有超过五条线.每行中的大写字母最终将被排序(所有As,所有C,所有Es等).我应该看正则表达式吗?
我以前从未编程,但需要编写一个非常简单的webapp来工作.
我正试图让这个挖掘查询工作:
dig @8.8.8.8 +nocomments +nostats +noquestion +nocmd google.com any
Run Code Online (Sandbox Code Playgroud)
有了这个perl:
$dig = `/usr/bin/dig \@8.8.8.8 +nocomments +nostats +noquestion +nocmd $query any`;
Run Code Online (Sandbox Code Playgroud)
除了它在挖掘结束时似乎没有认识到"任何"并且给了我:
sh: line 1: any: command not found
Run Code Online (Sandbox Code Playgroud)
我做错了什么愚蠢的简单事情?