in reply to CSV file with double quotes

For some reason that makes no sense at all I prefer not to use modules if I donīt need to. I do realise this is stupid but I canīt help it. Had you considered using split on the " into three strings and then doing a split on the , for the first and third? Or is that a bit silly?

Replies are listed 'Best First'.
Re^2: CSV file with double quotes
by chrestomanci (Priest) on Sep 15, 2011 at 20:24 UTC

    In most cases it is silly not to use modules. If you write something yourself you are unlikey to spend more than a few hours on it, and there will be bugs. The module authors will have spend a lot of time examining and debugging the problem, and finding all the corner cases with the help of user bug reports.

    If you can't compile binary modules then for CSV there is a pure perl altertanive that is slower, bu still much better tested than anything you can write.

    If you Boss won't allow you to install modules then unless there is a very good reason, you should probably be looking for a new Boss.

      We have security requirements in our industry to not install additional modules. Is there a way to do this without modules?
        Yes, and it shows how your security rules keep you safe: Just copy the code from the modules manually into your codebase. It means you won't get any security fixes, but hey, you're safe ;-)

        ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

        Of course. Everything on CPAN is open source. Simply read the source, understand it and re-implement it in your protected environment.

        We have security requirements in our industry to not install additional modules.

        Incredible stupid policy. How should that make anything more secure? People will find crappy workarounds, like copying existing code from CPAN or poorly reimplementing the wheel. Copying code will prevent any security and bugfix updates from happening, so that policy makes your software insecure. And please don't make start ranting about reimplementing wheels. I've seen far too much crappy code written by incompetent people in areas where bugs could hurt or kill people.

        With policies at this stupidy level, I would try to get the policies removed. If that fails, I would quit the job.

        Alexander

        --
        Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
Re^2: CSV file with double quotes
by Anonymous Monk on Feb 12, 2020 at 08:59 UTC

    For some reason that makes no sense at all I prefer not to use modules if I donīt need to.

    using perlmonks is exactly like using modules

      > using perlmonks is exactly like using modules

      No, it's worse, as the code posted to PerlMonks hasn't been tested by CPAN testers and users of the module.

      map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]