in reply to Re^2: split function
in thread split function

I understand all code except my $view = (split(/:/ , $setView))1

split returns a list, and a list, properly parenthesized, can be subscripted:

c:\@Work\Perl\monks>perl -wMstrict -le "my $one = ('zero', 'uno', 'two')[1]; print qq{'$one'}; " 'uno'


Give a man a fish:  <%-(-(-(-<

Replies are listed 'Best First'.
Re^4: split function
by gimcdan (Acolyte) on Apr 28, 2015 at 14:16 UTC

    Thanx Anamalous! Now it's perfectly clear. I am very new to perl and it's multitude of ways to accomplish tasks. And if I listen to co-workes, I should be learning javascript because perl is so passe`.

      Just for the sake of completeness, I should mention that lists can be sliced as well as subscripted:

      c:\@Work\Perl\monks>perl -wMstrict -le "my ($kilo, $papa, $quebec, $romeo, $delta) = ('a' .. 'z')[ 10, 15 .. +17, 3 ]; print qq{'$delta' '$kilo' '$papa' '$quebec' '$romeo'}; " 'd' 'k' 'p' 'q' 'r'


      Give a man a fish:  <%-(-(-(-<