Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
次のような文字列があります。
$string = "タグ: 甘い、おいしい、チョコレート、暗い"
これらのタグを Mysql テーブルに挿入したいと考えています。
では、[タグ:] を文字列から切り取るにはどうすればよいでしょうか。
また、Mysql テーブルに foreach $string を追加するにはどうすればよいですか?
「Tags:」を正規表現で削除することから始めてから、「,」で分割します。
my $string = "Tags: sweet, yummie, chocolate, dark" $string =~ s/Tags: //; my @tags = split /, /, @string;
MySQL 接続には、DBI::MySQL を使用できます。