#!/usr/bin/perl -w use strict;
my($arg, $s);
foreach $arg (@ARGV) { $s = "$arg $s"; } print $s;
$> ./t.pl 12 34 56 Use of uninitialized value in concatenation (.) or string at ./t.pl line 8. 56 34 12
왜 에러가 발생하는지 모르겠네요.
변수를 초기화하지 않아서 그렇습니다.
#!/usr/bin/perl -w use strict; my $s; print $s;
위의 코드는 경고(warning)를 냅니다.
다음과 같이 변수에 빈 문자열을 넣어주세요.
#!/usr/bin/perl -w use strict; my $s = ""; print $s;
--------------------Signature-------------------- "What can change the nature of a man?"
$s를 초기화하지 않고 읽었기 때문입니다.
my($arg, $s) = ('', ''); 로 초기화하면 됩니다.
..
텍스트 포맷에 대한 자세한 정보
<code>
<blockcode>
<apache>
<applescript>
<autoconf>
<awk>
<bash>
<c>
<cpp>
<css>
<diff>
<drupal5>
<drupal6>
<gdb>
<html>
<html5>
<java>
<javascript>
<ldif>
<lua>
<make>
<mysql>
<perl>
<perl6>
<php>
<pgsql>
<proftpd>
<python>
<reg>
<spec>
<ruby>
<foo>
[foo]
변수를 초기화하지
변수를 초기화하지 않아서 그렇습니다.
위의 코드는 경고(warning)를 냅니다.
다음과 같이 변수에 빈 문자열을 넣어주세요.
--------------------Signature--------------------
"What can change the nature of a man?"
$s를 초기화하지 않고
$s를 초기화하지 않고 읽었기 때문입니다.
my($arg, $s) = ('', '');
로 초기화하면 됩니다.
와.. 빠른 답변 감사합니다.. ^^
..
댓글 달기