Snippets

sironekotoro Perl入学式 2018 第3回 練習問題 hash_profile.pl

Created by sironekotoro

File hash_profile.pl Added

  • Ignore whitespace
  • Hide word diff
+#!/usr/bin/env perl
+use strict;
+use warnings;
+
+# Perl入学式 2018 第3回 練習問題
+# https://github.com/perl-entrance-org/workshop-2018/blob/master/3rd/slide.md
+# 練習問題(hash_profile.pl)
+
+# 次の処理をする hash_profile.pl を作りましょう。
+
+# 1. 自分の名前 (name)、年齢 (age)、好きな食べ物 (food) を key にしたハッシュ %my_profile を作ってください。
+my %my_profile = ( name => 'sironekotoro', age => '200', food => 'ramen' );
+
+# 2. key である name, age, food を使って、それぞれの value を出力してください。
+print $my_profile{name}, "\n";    # sironekotoro
+print $my_profile{age},  "\n";    # 200
+print $my_profile{food}, "\n";    # ramen
+
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.