PERLã«ã¦2次å é åã®åçãªä½ææ¹æ³ãæãã¦ãã ããã
PERLã«ã¦2次å é åã®åçãªä½ææ¹æ³ãæãã¦ãã ããã
2007å¹´08æ04æ¥04:30 ã«ãã´ãªLightweight Languages perl - åæã«æ·»å - ãã³ãã³åç»ãã¦ã³ãã¼ãã¼ ã¹ã©ã¤ãããªãã¨ãä¸ãã£ãã®ã§ããªãããªãããã¦ä¹ ã ã®æ·»åã Perlã§ãã³ãã³åç»ã®flvã¨ã³ã¡ã³ãxmlããã¦ã³ãã¼ããã (Yusukebe::Tech) ããããæ¢åºãããããªããã©Perlã§ãã³ãã³åç»ã®flvãã¡ã¤ã«ã¨ã³ã¡ã³ãã®xmlãã¡ã¤ã«ããã¦ã³ãã¼ãããã¹ã¯ãªãããã¾ãã¯çµæããã #!/usr/bin/env perl # # $Id: nicoget.pl,v 0.1 2007/08/03 19:26:19 dankogai Exp dankogai $ # original: http://yusukebe.com/tech/archives/20070803/124356.html # use strict; use wa
å¹ åªå æ¢ç´¢ã§è¿·è·¯ã®æççµè·¯ãæ¢ã 2010-01-14-4 [Algorithm][Programming] è¿·è·¯ã®æççµè·¯ãæ¢ãããã°ã©ã ãä½æããã¨ããåé¡ã«ã¤ãã¦ã - 人æç²å¾ä½æ¦ã»ï¼ã試é¨åé¡ã»ã (人çãæ¸ãæããè ããããã) http://okajima.air-nifty.com/b/2010/01/post-abc6.html ããã¯åãªãå¹ åªå ã§OKã§ããã 足跡ãè¨é²ãã¦ããããã§ã«å¥ã®åãéã£ãéã«ã¶ã¤ãããï¼è¶³è·¡ã®æç¡ã§å¤å®ï¼ãè¡ãæ¢ã¾ãã«å°éãããæç©ãã å¹ åªå ãªãã ããããã§è¦ã¤ããã®ãæççµè·¯ã å¾ããã®ãæçæ§ã®ãã§ãã¯ãã¯ä¸è¦ã§ãã ãã¢ã«ã´ãªãºã ç¥ããªãã¨ã§ããªããã¨ã以åã®åé¡ã§ãæ£å¼ã«ããã°ã©ãã³ã°ã®åºç¤ãå¦ãã 人ãªãã§ãã¦å½ããåã®åé¡ã§ãããã³ã¨æ¥ãªã人ã¯ããã¤ã³ã¿ããããªããå帰ããããªã人ã¨ååããªãã ããªããªããã°ã©ãã³ã°ããã¯ä¸ç·
ãWeb API ã®ããããã¯å²ã¨æ¦å¿µçãªè©±ã«çµå§ãã¦ãã¦ãã³ã¼ããã¼ã¹ã®ãã£ã¨ã´ãªã£ã¨ãã話ãæå¾ ãã¦ãã人ã«ã¯ç³ã訳ããã¾ããã§ããã ãããã¯ãæ¢åã® WAF ã使ã£ã¦ããã ãã ã¨ããããªããã¨ã£ã¦ããã®ãå¤ãã¨æãã®ã§ããã£ã¨ä¸ã®ã¬ã¤ã¤ã¼ã«éãã¦ãèªåã§å®è£ ããã®ããããªããããªãã®ããªã£ã¦æã£ã¦ãã¾ãã ãlet's database testingãã§ã¯ãå²ã¨è¦è½ã¨ãããã¡ãªããããªããã¨ãããDB ã®ãã¹ãæ¹æ³ã«ã¤ãã¦ãã£ãã°ããã«è©±ãã¾ãããã¡ãã£ã¨æ¬è³ªçã§ãªããã¨ãæ¸ãã¦ããã¾ãããéè¦ãªã®ã¯ããå®éã«éç¨ãããç°å¢ã«*ãªãã¹ã*è¿ãç°å¢ã§ããã¼ã«ã«ã§ãã¹ãããããã£ã¦ãã¨ã§ããDB ãã¹ãã®ã»ãã®è¶³ãããã«ãªãã°å¹¸ãã§ãã BD ãã¹ãã®è©±ã§ä½¿ã£ããµã³ãã«ã®ãªãã¸ããªã¯ä»¥ä¸ã«ãªã£ã¦ãã¾ãã xaicron's Mayoi at master - GitHub çµæ§ä¸éå
Thread(Perl 5.6?)ãªãasyncã§ã¹ã¬ãããå®è¡ããã°ãåãã¢ã¸ã¥ã¼ã«ã®ã¬ãã·ã«ã«å¤æ°(myã§å®£è¨ããå¤æ°)ãå ±æã§ããã ããã°ã©ãã³ã°Perl P.536ã®ä¾ãithreads(Perl 5.8)ã§ã¯å®è¡ã§ããªã ithreadsã§ã¯threads::sharedã使ã£ã¦å¤æ°ãæ示çã«å ±æããå¿ è¦ãããã use threads::shared; å ±æãã¼ã¿ã¨éå ±æãã¼ã¿ iã¹ã¬ãã 㨠5.005åã¹ã¬ããã®éã®ï¼ãã£ã¨ããã°ãããããå¤ããå¤ãã®ã¹ã¬ããã·ã¹ãã ã«ã¨ã£ã¦ã®ï¼æ大ã®éãã¯ãããã©ã«ãã§ãã¼ã¿ãå ±æãããªãã¨ããç¹ã ãæ°ããperlã¹ã¬ãããçæãããã¨ããç¾å¨ã®ã¹ã¬ããã«é¢é£ããå ¨ã¦ã®ãã¼ã¿ã¯æ°ããã¹ã¬ããã«ã³ãã¼ããããç¶ãã¦ãã®ãã¼ã¿ã¯æ°ããã¹ã¬ããå ã§ãã©ã¤ãã¼ããªãã®ã¨ãªãï¼ããã¯UNIXã®ããã»ã¹ãforkããã¨ãã«èµ·ãããã¨ã¨ä¼¼ã¦ããããã
HOMMEZ(ãªã ãº)ã¯ç·æ§ã®å¿ã¨èº«ä½ã®å¥åº·ãæ¯æ´ããä¸äººã§ãå¤ãã®äººãåä¾ãå¾ã幸ããç·æ§ã¨ãã¦ã®åã³ã享åã§ãã社ä¼ã®å®ç¾ãç®æãã¦ãã¾ããç·æ§ã®å¦æ´»ãæ´»åã«ã¾ã¤ããæ å ±ãååã®åã§æ§ãå¦æ´»ã«æ©ãç·æ§ãå¹ççã«ç´å¾æãæã£ã¦æ´»åã§ããæ©ä¼ãåµåºãã¾ãã
åå¶ threads - ã¤ã³ã¿ããªã¿ã¹ã¬ããã®ä½¿ç¨ãå¯è½ã«ããPerlæ¡å¼µ æ¦è¦Â¶ use threads; sub start_thread { print "Thread started\n"; } my $thread = threads->create("start_thread","argument"); my $thread2 = $thread->create(sub { print "I am a thread"},"argument"); my $thread3 = async { foreach (@files) { ... } }; $thread->join(); $thread->detach(); $thread = threads->self(); $thread = threads->object( $tid ); $thread->tid(); thr
Perlã®ithreadsã«ã¤ã㦠ithreadsã«é¢ããæ¥æ¬èªã®ãµã¤ãããã¾ããªãã®ã§ãä½ãé©å½ã«ã¡ã¢ã£ã¦ããã¾ãã åºæ¬ ãµã³ãã« çæç¹ï¼éè¦ãªåºæ¬äºé ï¼ ã§ããã ãææ°ã®Perlã§ä½¿ãã ã¹ã¬ããã®ã³ã³ããã¹ã ã¹ã¬ããã¨å¤ ãªãã¸ã§ã¯ãã®å ±æ ãªãã¸ã§ã¯ãã¯äºåº¦ï¼ä»¥ä¸ï¼æ»ã¬ Windowsä¸ã§ã®detach ç¹å¥ãªãµãã«ã¼ãã³CLONEã«ã¤ã㦠ãã«ãã¹ã¬ããã«ãããrand()ã®ä½¿ç¨ ã¹ã¬ããã«ãããã·ã°ãã«å¦ç é¢é£æ å ± ã¢ã¸ã¥ã¼ã« ãã®ä» forkã«ããthreadsã®ã¨ãã¥ã¬ã¼ã cond_timedwait ãªããã¹ã¬ããã®çæã«æéããããæãããã®ã§ãã⦠Thread::Queueã«ã¤ã㦠CLONEãµãã«ã¼ãã³ ãã«ãã¹ã¬ããã«ãããåç¾æ§ã®ããä¹±æ°å Thread::TieãWIN32 with activeperlã§ä½¿ã ã¹ã¬ãããçãã¦ãããã©ããã®ãã§
2003å¹´3æ15æ¥ (å) - Perl ithreads ä¼æ¥ãªã®ã§ã Perl 5.8.0ã®ãã«ãã¹ã¬ããããã°ã©ãã³ã°ã§éã¶ã use v5.8.0; use strict; use threads; my $thread1 = threads->new(\&main, "One"); my $thread2 = threads->new(\&main, "Two"); $thread1->join; $thread2->join; print "done.\n"; sub main { my ($name) = @_; for (1..10) { print "I am $name ($_)\n"; threads->yield(); } } 以ä¸ãå®è¡ä¾ã I am One (1) I am One (2) I am Two (1) I am One (3) I am Two
bashã§ãããå¦çãæ¸ãéã«ä¾¿å©ãªã®ãgetopts ä¾ãã° batch.sh -f aaa.txt -d 20080829 ã£ã¦æãã§å¼æ°ãå¦çãããå ´å #!/bin/bash OPTIONS="f:d:" while getopts $OPTIONS opt $@ do case $opt in "f") filename=$OPTARG ;; "d") date=$OPTARG ;; *) exit -1;; esac done ã£ã¦æãã§å¦çã§ãã é¢æ°ã«å¼æ°ã渡ãå½¢ã§é åå ã«ããå¤ã«å¯¾ãã¦å¦çãè¡ããµã³ãã«ãä½ã£ã¦ã¿ã test1.sh #!/bin/bash OPTIONS="f:i:" aryItems=(a.txt b.jpg c.pdf) aryItemCD=(100 200 300) main() { unset filename unset image_cd wh
ç°¡æãªãã·ã§ã³ã®åå¾ (module)Getopt-Std back Perl::Getoptã»Getoptions æ¨æºã¢ã¸ã¥ã¼ã« #usage #perl getopt.pl -o test -D test2 -I test3 #output #test,test2,test3 use Getopt::Std; getopt('oDI'); print "$opt_o,$opt_D,$opt_I","\n"; å¼æ°ãåããã¿ã¤ããå¾ãã«ãï¼ããã¤ãã¦ããªãã®ããã©ã°åã #usage #perl getopt.pl -a -b test2 -c test3 -d #output #1,test2,test3,1 getopts('ab:c:d'); print "$opt_a,$opt_b,$opt_c,$opt_d","\n"; ããã·ã¥ã§åãåãã«ã¯ getopt('abcde',
è¤æ°ã®ããã»ã¹ã§ããã¯ç¶æ ãç°å¸¸ã§ããã¨å¤æãï¼ãã®ãã¡ã® 1ã¤ãããã¯ã解é¤ãããã¨ã«ããï¼å¥ã®ããã»ã¹ãããã¯ããã«ãã ããããï¼å ã»ã©ããã¯ç¶æ ãç°å¸¸ã§ããã¨å¤æããããã»ã¹ã«ãã£ã¦ãã®æ£å¸¸ãªãã ã¯ã解é¤ããã¦ãã¾ãå¯è½æ§ãããã¾ãï¼ ãã®æ¹æ³ã®åé¡ç¹ã¯ï¼ç°å¸¸ãªããã¯ç¶æ ã解é¤ããæä½ãæ£å¸¸ãªããã¯ç¶æ ãã 解é¤ã§ãã¦ãã¾ããã¨ã«ããã¾ãï¼éã«è¨ãã°ï¼ç°å¸¸ãªããã¯ç¶æ ã解é¤ããæä½ã« ãã£ã¦æ£å¸¸ãªããã¯ç¶æ ã解é¤ã§ããªããã°åé¡ãªãããã§ãï¼ãã®ããã«ã¯ã©ãã ãã°ããã®ãï¼ çãã¯ããã¯ç¶æ ã常ã«å¤åãã¦ããã° ããã¨ãããã¨ã§ãï¼ããã¦ï¼ãããå®ç¾ããã®ã«é½åãããã®ã rename ã«ããæ¹æ³ã«ãªãã¾ãï¼ æåã®ã¹ã¯ãªããã§èª¬æãã¾ãã¨ï¼ããã¯ãã¡ã¤ã«ã lockfile ã¨ãã ååã®ã¨ããããã¯ã解é¤ããã¦ããç¶æ ã§ï¼lockfile987654321 ã®ãã ã«å¾ãã«
ãã®ãã¼ã¸ã¯ Perl5.6 ã対象ã¨ãã¦ãã¾ãï¼ perl ã¹ã¯ãªãã㯠EUC-JP ã§æ¸ããããã¨ãæ³å®ãã¦ãã¾ãï¼ ãã®ãã¼ã¸ã¯ æ£è¦è¡¨ç¾ã¡ã¼ãªã³ã°ãªã¹ã ãåèã«ï¼ç§ãç¬èªã«ã¡ã¢ã¨ãã¦ã¾ã¨ãããã®ã§ãï¼ ãã®ãã¼ã¸ã®æ£è¦è¡¨ç¾ãã¹ã¯ãªããã«ã¤ãã¦ã®è©³ãã説æï¼ ãããããã説æã¯ããããã§ãã¾ããï¼ ãã®ãã¼ã¸ã«æ¸ããã¦ããã¹ã¯ãªããã¯ï¼ å人ã®è²¬ä»»ã«ããã¦å®è¡ãã¦ãã ããï¼ ãã®ãã¼ã¸ã«æ¸ããã¦ããã¹ã¯ãªããã® å©ç¨ã»æ¹é ã¯èªç± ã§ãï¼ ãã®éã¯ã©ããã«ãã®ãã¼ã¸ã® URI( http://www.din.or.jp/~ohzaki/regex.htm )ãåèã¨ãã¦è¨è¿°ãã¦ããã ããã°å¹¸ãã§ã(ä»»æ)ï¼ ãæè¦ã»ãææ³ã»ãè¦æãªã©ã¯ ã«ãé¡ããã¾ãï¼ããæ¸ããæ¹ãããï¼ åããï¼ããããï¼ãã°ã£ã¦ãï¼ããæ¸ãï¼ãªã©ãªã©ãå¾ ã¡ãã¦ãã¾ãï¼ ãã®ãã¼ã¸ã¸ã® ãªã³ã¯ã¯èªç± ã«å¼µã£ã¦ã
é åããç¹å®ã®å¤ãåé¤ãããå ´åã«ä½¿ç¨ãããµãã«ã¼ãã³ãå¼æ°ã¯ãé åã®ãªãã¡ã¬ã³ã¹ã¨åé¤ãããå¤ãæå®ããã 注æç¹ã¨ãã¦ãµãã«ã¼ãã³ã¸ã®å¼æ°ã¯ãé åã¨ã¹ã«ã©ã¼å¤ãåæã«æ¸¡ããªãããé åãä¸æ¦ãªãã¡ã¬ã³ã¹ï¼ã¹ã«ã©ã¼å¤ï¼ã«ãã¦ããå¿ è¦ãããã # æå®ããå¤ãé åããåé¤ (é åã®ãªãã¡ã¬ã³ã¹ãåé¤ããå¤) @output = &delArray(\@input, $value); sub delArray { my($array,$v) = @_; my @new = (); foreach (@{$array}) { next if($v eq $_); push(@new,$_); } return @new; }
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}