Name : perl-Inline-Awk
| |
Version : 0.04
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : 1.2
| Date : 2017-08-04 16:04:09
|
Group : Development/Libraries/Perl
| Source RPM : perl-Inline-Awk-0.04-1.2.src.rpm
|
Size : 0.03 MB
| |
Packager : (none)
| |
Summary : Add awk code to your Perl programs
|
Description :
The \'Inline::Awk\' module allows you to include awk code in your Perl program. You can call awk functions or entire programs.
Inline::Awk works by converting awk code into Perl code using the \'a2p\' utility which comes as standard with Perl. This means that you don\'t require awk to use the Inline::Awk module.
Here is an example of how you would incorporate some awk functions into a Perl program:
use Inline AWK;
$num = 5; $str = \'ciao\';
print square($num), \"\ \"; print echo($str), \"\ \";
print \"Now, back to our normal program.\ \"
__END__ __AWK__
function square(num) { return num * num }
function echo(str) { return str \" \" str }
You can call an awk program via the \'awk()\' function. Here is a simple version of the Unix utility \'wc\' which counts the number of lines, words and characters in a file:
use Inline AWK;
awk();
__END__ __AWK__
BEGIN { file = ARGV[1] }
{ words += NF chars += length($0) +1 # +2 in DOS }
END { printf(\"%7d%8d%8d %s\ \", NR, words, chars, file) }
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-I/openSUSE_Tumbleweed/noarch |