use threads; foreach ( 1 .. 5 ) { $a = threads->create( \&t ); push @a, $a; $a = $a + $_; } $m = threads->create( \&r ); foreach (@a) { my $t = $_; $t->join(); } $m->join(); sub r { while (1) { print $a= threads->list(threads::running) . “\n”; threads->create( \&t ) if $a < [...]
Posts Tagged ‘perl’
perl gettime
二月 9th, 2012
lookdata #!/usr/bin/perl use warnings; use strict; sub getTime { my $time = shift || time(); my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($time); $year += 1900; $mon ++; $min = ’0′.$min if length($min) < 2; $sec = ’0′.$sec if length($sec) < 2; $mon = ’0′.$mon if length($mon) < 2; $mday = ’0′.$mday if length($mday) < 2; $hour = ’0′.$hour if [...]
perl bin目录下的文件
一月 12th, 2012
lookdata search.bat 相当于是linux find psed.bat 同样相当于是linux sed 每一个bat文件都有一个头 @rem = ‘–*-Perl-*– @echo off if “%OS%” == “Windows_NT” goto WinNT perl -x -S “%0″ %1 %2 %3 %4 %5 %6 %7 %8 %9 goto endofperl :WinNT perl -x -S %0 %* if NOT “%COMSPEC%” == “%SystemRoot%\system32\cmd.exe” goto endofperl if %errorlevel% == 9009 echo You do not have [...]
RSS Feed
Posted in
Tags: