Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: I prefer my indexes to start at:

by Tux (Canon)
on Sep 01, 2022 at 14:50 UTC ( [id://11146618]=note: print w/replies, xml ) Need Help??


in reply to I prefer my indexes to start at:

0 unless spreadsheets. Using 0 in any spreadsheet will confuse the hell out of any programmer dealing with Excel or LibreOffice where everything starts with 1.

That said, 0 is thusly available for metadata :). You can accuse me of misuse or even abuse of 0 in these evil data structures.


Enjoy, Have FUN! H.Merijn

Replies are listed 'Best First'.
Re^2: I prefer my indexes to start at:
by LanX (Saint) on Sep 18, 2022 at 19:51 UTC
    > 0 unless spreadsheets.

    I think you can make the same exception for SQL tables, since ROW_NUMBER() starts with 1.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

Re^2: I prefer my indexes to start at:
by ELBeavers (Novice) on Sep 18, 2022 at 17:47 UTC
    Since sheet row 2 is usually the first row of data in a spreadsheet, thinking of the header as data row(0) makes sense as it's followed by the first data row of data(1).
    my $name = "Eric Beavers\n"; my $email = "elb"; my $website = "carryingstones.com\n"; print $name, $email, '@', $website;

      Assumption is the mother of all FU's

      The danger in your remark is the word usually. Been there done that. And even if the data you are dealing with initially had a header row, there is no guarantee that the next time you get that data from external sources will have (the same) header line or that they either left it out, changed the order, spelling, casting or even inserted line(s) before the header to add "comments" or "instructions". Excel is likely one of the most misused/abused end-user tools in the (ICT) world. I *never* assumer anything in Excel, not even correct encoding or default (date) formatting.


      Enjoy, Have FUN! H.Merijn

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11146618]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (7)
As of 2024-04-24 10:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found