I've also tried -2 and -3.
use Text::CSV; my $csv_tie = Text::CSV->new({binary=>1}) or die "CSV doesn't work: ". +Text::CSV->error_diag(); my $csv_file = "some_file.csv"; if(open my $H_csv_file, "<", $csv_file){ while(my $row = $csv_tie->getline($H_csv_file)){ printf "(%s)\n", join(';', @$row[0..-1]); #I tried also @{$row +}[0..-1] } close($H_csv_file); }else{ print STDERR "Can't open CSV csv: $csv_file\n"; }
Prints emtpy results for each record in csv file:

() () () () ()

, but, if I use some positive index number, like 0..7, for example, it works fine:

(1094;СР600;7;28;42722;International;84abcdefgh0;Molokov) (1095;СР200;7;28;42722;International;84abcdefgh5;Babin) (1096;СР200;7;28;42722;International;84abcdefgh9;Rechkunova)

I've read in perl documentation about slices, it gives examples with negative numbers, so it should work?, I would suppose.

In reply to Slicing an array variable with a -1 or any negative number doesn't work by igoryonya

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.