http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13240

--- Comment #18 from Colin Campbell <[email protected]> ---
(In reply to Jonathan Druart from comment #12)
> (In reply to Colin Campbell from comment #11)
> > In the perl world using $x->{one}->{two} rather than $x->{one}{two} is the
> > most common. one reason is that the arrow syntax can be used in a string
> > e.g. print "Var: $x->{one}->{two}"
> > 
> > using the non-arrow syntax in this way does not do what you may think it 
> > does
> 
> Are you sure?
> I often use it, 
> 
>   use Modern::Perl;
>   my $h = { foo => { bar => 'foobar' } };
>   say "my string with $h->{foo}->{bar}";
>   say "my string with $h->{foo}{bar}";
> 
> outputs:
> 
>   my string with foobar
>   my string with foobar

Without pausing fpr thought its not obvious which of the first three is doing
what you want:
#!/usr/bin/perl
use feature qw( say );
my $list = [ 'foo', 'bar' ];
say "my string with $list[0]";
say "my string with ${list}[0]";
say "my string with ${$list}[0]";

say "my string with $list->[0]";

outputs:
my string with 
my string with ARRAY(0x936cb8)[0]
my string with foo
my string with foo

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to