Created
May 10, 2012 03:40
-
-
Save raimon49/2650901 to your computer and use it in GitHub Desktop.
Perlでパイプから受け取った内容を一時ファイルに書き出してほげほげする
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
use strict; | |
use warnings; | |
use File::Temp qw(tempfile); | |
my $fh; | |
my $f; | |
unless ( -t STDIN) { | |
($fh, $f) = tempfile( | |
CLEANUP => 1 | |
); | |
while (<STDIN>) { | |
print $fh $_; | |
} | |
} | |
# $fにほげほげ | |
if ($f) { | |
print $f; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment