One Hat Cyber Team
Your IP :
216.73.216.115
Server IP :
194.44.31.54
Server :
Linux zen.imath.kiev.ua 4.18.0-553.77.1.el8_10.x86_64 #1 SMP Fri Oct 3 14:30:23 UTC 2025 x86_64
Server Software :
Apache/2.4.37 (Rocky Linux) OpenSSL/1.1.1k
PHP Version :
5.6.40
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
doc
/
perl-IPC-Run
/
eg
/
View File Name :
factorial_scalar
#!/usr/bin/perl -w ## Demonstration of using a scalar to queue input to a child process use strict; use IPC::Run qw( start timeout ); die "usage: $0 <num>\n\nwhere <num> is a positive integer\n" unless @ARGV; my $i = shift; die "\$i must be > 0, not '$i'" unless $i =~ /^\d+$/ && $i > 0; my ( $in, $out ); my $h = start ['bc'], \$in, \$out, timeout(5); $in = "a = i = $i ; i\n"; while () { $out = ''; $h->pump until $out =~ s/.*?(\d+)\n/$1/g; print "bc said: $out\n"; if ( $out > $i ) { print "result = $out\n"; $in = undef; last; } elsif ( $out == '1' ) { ## End of calculation loop, get bc to output the result $in = "a\n"; } else { $in = "i = i - 1 ; a = a * i ; i\n"; } } $h->finish;