Skip to content

Instantly share code, notes, and snippets.

@Code-Hex
Created August 21, 2014 05:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Code-Hex/449d6683e2086089eae8 to your computer and use it in GitHub Desktop.
Save Code-Hex/449d6683e2086089eae8 to your computer and use it in GitHub Desktop.
ダイヤモンド演算子
#! /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
@Code-Hex
Copy link
Author

似たような形で while() も存在するけど、これはファイルの読み込みは不可能で、標準入力しかできない

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment