Perl a velky skalar

Pavel Šmerk xsmerk na informatics.muni.cz
Středa Duben 4 19:19:28 MEST 2001


Honza Pazdziora wrote:

> Potrebujeme videt presny kod.

Zkusil jsem to co nejvice zjednodusit (perl 5.6 od activestatu na windows NT mi to
dela taky):

anxur-pts/101$ cat a.pl
#!/usr/bin/perl -w
$_ = ' ' x 1000 x 1000; warn grep ($_ !~ /grep/, split /\n/, `ps -o "vsz rss osz
fname"| grep 'a.pl'`), "\n";
s/(  ) (  ) /$2 $1 /sg; warn grep ($_ !~ /grep/, split /\n/, `ps -o "vsz rss osz
fname"| grep 'a.pl'`), "\n";
s/(  ) (  ) /$2 $1 /sg; warn grep ($_ !~ /grep/, split /\n/, `ps -o "vsz rss osz
fname"| grep 'a.pl'`), "\n";
s/(  ) (  ) /$2 $1 /sg; warn grep ($_ !~ /grep/, split /\n/, `ps -o "vsz rss osz
fname"| grep 'a.pl'`), "\n";
s/(  ) (  ) /$2 $1 /sg; warn grep ($_ !~ /grep/, split /\n/, `ps -o "vsz rss osz
fname"| grep 'a.pl'`), "\n";
s/(  ) (  ) /$2 $1 /sg; warn grep ($_ !~ /grep/, split /\n/, `ps -o "vsz rss osz
fname"| grep 'a.pl'`), "\n";
anxur-pts/101$ nice ./a.pl
4160 3744  520 a.pl
6208 5720  776 a.pl
7232 6704  904 a.pl
8256 7688 1032 a.pl
9280 8672 1160 a.pl
10304 9656 1288 a.pl
anxur-pts/101$ perl -v

This is perl, version 5.004_04 built for sun4-solaris


aurora$ cat a.pl
#!/usr/bin/perl -w
$_ = ' ' x 1000 x 1000; warn grep ($_ !~ /grep/, split /\n/, `ps u | grep '$0'`),
"\n";
s/(  ) (  ) /$2 $1 /sg; warn grep ($_ !~ /grep/, split /\n/, `ps u | grep '$0'`),
"\n";
s/(  ) (  ) /$2 $1 /sg; warn grep ($_ !~ /grep/, split /\n/, `ps u | grep '$0'`),
"\n";
s/(  ) (  ) /$2 $1 /sg; warn grep ($_ !~ /grep/, split /\n/, `ps u | grep '$0'`),
"\n";
s/(  ) (  ) /$2 $1 /sg; warn grep ($_ !~ /grep/, split /\n/, `ps u | grep '$0'`),
"\n";
s/(  ) (  ) /$2 $1 /sg; warn grep ($_ !~ /grep/, split /\n/, `ps u | grep '$0'`),
"\n";
aurora$ ./a.pl
xsmerk   17120  0.0  0.3  4432 3160 pts/25   S    18:52   0:00 perl -w ./a.pl
xsmerk   17120 53.0  0.4  5412 4180 pts/25   S    18:52   0:01 perl -w ./a.pl
xsmerk   17120 52.2  0.5  6392 5160 pts/25   S    18:52   0:02 perl -w ./a.pl
xsmerk   17120 51.5  0.6  7372 6140 pts/25   S    18:52   0:03 perl -w ./a.pl
xsmerk   17120 51.1  0.7  8352 7120 pts/25   S    18:52   0:04 perl -w ./a.pl
xsmerk   17120 56.4  0.8  9332 8100 pts/25   S    18:52   0:05 perl -w ./a.pl
aurora$ perl -v

This is perl, version 5.005_03 built for i386-linux




Další informace o konferenci Perl