Created
August 21, 2014 05:01
-
-
Save Code-Hex/449d6683e2086089eae8 to your computer and use it in GitHub Desktop.
ダイヤモンド演算子
This file contains 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 | |
use strict; | |
use warnings; | |
use 5.010; | |
my $n = "\n"; | |
while(<>){ | |
# chomp; で、改行を取り消すことが可能 | |
print "$_"; | |
} | |
= | |
result | |
っっっっっっ | |
っっっっっっ | |
adqd | |
adqd | |
DWQDDC | |
DWQDDC | |
039 | |
039 | |
--- | |
ファイルの読み込みも可能 | |
% diamond.pl diamond.pl | |
#! /usr/bin/perl | |
use strict; | |
use warnings; | |
use 5.010; | |
my $n = "\n"; | |
while(<>){ | |
# chomp; で、改行を取り消すことが可能 | |
print "$_"; | |
} | |
=cut |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
似たような形で while() も存在するけど、これはファイルの読み込みは不可能で、標準入力しかできない