in reply to Re: read files into 2D arrays and print element?
in thread read files into 2D arrays and print element?

I'm sorry about the lack of indentation - I don't know how to indent and, you'll probably be shocked by this, but this is actually me doing a good job at indenting... It's crap I know, it also makes me struggle. All I wanted to say with this is that this wasn't lazy formatting, this was just me not having a clue.

I've tried to understand it but it goes over my head as all the tips I've read are probably more intuitive rather than explanatory, or they assume certain fluency in perl/general programming. I apologise for the bad formatting, I need to learn how to do it at some stage.

  • Comment on Re^2: read files into 2D arrays and print element?

Replies are listed 'Best First'.
Re^3: read files into 2D arrays and print element?
by stevieb (Canon) on Nov 29, 2016 at 17:24 UTC

    Essentially, any time you are operating in a block (typically defined by statements that use { and } to denote a block), you indent a single time:

    for (@things){ # this is a block. indent once if ($_ eq 'blah'){ # this is an inner block, indent twice while (1){ # 2nd level inner block # indent three times } if (0){ # another 2nd level inner block } # back in 1st inner block } # back in outer block } # back to top level
Re^3: read files into 2D arrays and print element?
by hippo (Archbishop) on Nov 29, 2016 at 17:23 UTC

    In that case you could do a lot worse than perltidy.

Re^3: read files into 2D arrays and print element? (indentation editor)
by LanX (Saint) on Nov 29, 2016 at 17:40 UTC
    > I don't know how to indent

    My editor does it for me, which one do you use?

    I'm sure you'll find someone here telling you how to do it there.

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!

      I am using either vi or gedit. I think Notepad++ helps a bit but I can't get it on some computers (Uni computers, can't download stuff etc).

      I understood indenting is done in blocks, as it was also pointed out earlier. As in, when something *separate* from the other things is happening, I should indent. But I don't think I was doing it correctly.

      Can I bother you all with one more thing? I've commented on my question asking one more thing, hopefully you'll be able to point what I'm doing wrong? I've spent days on this bit and still no luck.

        > Can I bother you all with one more thing? I've commented on my question asking one more thing, hopefully you'll be able to point what I'm doing wrong?

        Please don't do this, little will notice and you are destroying the context of the answers.

        Rather reply to your own thread with new questions or even start a new thred if the drift is too large.

        > I am using either vi or gedit.

        I'm sure vi and gedit can do this, but I'm no expert there.

        Marking the editors in the title will hopefully attract those experts.

        Cheers Rolf
        (addicted to the Perl Programming Language and ☆☆☆☆ :)
        Je suis Charlie!