dポイントプレゼントキャンペーン実施中!

@town = ("Aタウン","Bタウン","Cタウン");


上のような配列の値を、テキストファイルに保存して読み込みたいのですが、どうしたらよいのか分かりません。

誰か詳しい方、よろしくお願いします。

A 回答 (1件)

use Storable qw(nstore retrieve);



my @towns = qw(TownA TownB TownC);
my $file = 'serialize.dat';
nstore( \@towns, $file ) || die "$file:$!";
@towns = ();

my $towns_ref = retrieve($file) || die "$file:$!";
print $_, $/ for @{$towns_ref};
    • good
    • 0

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!