Skip to content

Instantly share code, notes, and snippets.

@mgng
Created March 19, 2012 02:01
Show Gist options
  • Select an option

  • Save mgng/2090359 to your computer and use it in GitHub Desktop.

Select an option

Save mgng/2090359 to your computer and use it in GitHub Desktop.
Perlで引数に配列と文字列を渡したい場合
#!/usr/bin/perl
use strict;
use warnings;
my @list = (1,2,3,4);
my $str = 'unko';
func1( @list, $str);
func2( \@list, $str);
sub func1 {
my @list = @_;
my $str = pop( @list );
print @list, "\n", $str, "\n";
return;
}
sub func2 {
my ($list, $str) = @_;
print @$list, "\n", $str, "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment