Notice
Recent Posts
Recent Comments
목록해시안에 배열넣기 (1)
준호씨의 블로그

perl에서 array를 사용하는 방법은 다음과 같습니다. () 안에 값들을 넣어주면 됩니다. 출력 편의상 encode_json 함수를 사용했습니다. my @arr = ("hello", "world", "nice", "to", "meet", "you"); print encode_json(\@arr); # ["hello","world","nice","to","meet","you"] 만약 앞서 선언된 배열을 hash안에 넣고 싶다면 다음과 같이 할 수 있습니다. my @arr = ("hello", "world", "nice", "to", "meet", "you"); my %data = ( id => "myid", data => \@arr ); print encode_json(\%data); # {"id":"..
개발이야기
2021. 5. 2. 22:53