$foo = 99; # Assigns the integer 99 to $foo. Scalar context. @Foo = ('Jack', 5, 'Jill', 4, 'John', 7); # A list assigned to @foo, values separated by commas. %foo = ('Jack', 5, 'Jill', 4, 'John', 7); # A list as key, value pairs. Better ways to write this exist. #### $ perl -MPDL -e "print $PDL::VERSION;" #### $ perl -MPDL -e "$arr = sequence(10); print $arr;" #### $ perl -MPDL -e "$arr = ones(3,3), print $arr;" #### $ perl -MPDL -e "$arr = sequence(10); $odd = where($arr, ($arr%2) == 1); print $odd;" #### Input: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] Output: [ 0, -1, 2, -1, 4, -1, 6, -1, 8, -1] #### perl -MPDL -e "$arr = sequence(10); $odd = $arr->where($arr % 2 == 1); $odd .= -1 ; print $arr;" #### Input: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] Output: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] [ 0, -1, 2, -1, 4, -1, 6, -1, 8, -1] #### $ perl -MPDL -e "$arr = sequence(10); $out = sequence(10); $odd = $arr->where($arr %2 == 1); $odd .= -1; print $out, $arr;" #### Input: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9] Output: [ [0, 1, 2, 3, 4], [5, 6, 7, 8, 9] ] #### $ perl -MPDL -e "$seq = sequence(10); $seq_1 = $seq->reshape(5,2); print $seq_1;" #### Input: a = [0,1,2,3,4,5,6,7,8,9] b = [1,1,1,1,1,1,1,1,1,1] Output: [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9], [1, 1, 1, 1, 1], [1, 1, 1, 1, 1]] #### $ perl -MPDL -e "$arr_a = sequence(10); $arr_b = ones(10); $out = pdl( $arr_a, $arr_b )->reshape( 5,4 ) ; print $out; " #### Output: [[0, 1, 2, 3, 4, 1, 1, 1, 1, 1], [5, 6, 7, 8, 9, 1, 1, 1, 1, 1]] #### perl -MPDL -e "$arr_a = sequence(10)->reshape(5,2); $arr_b = ones(10)->reshape(5,2); print append( $arr_a, $arr_b );"