28

Found this little gem today in some legacy code at work.

Apparently this is the best way to split a datetime (hh:mm:ss mm/dd/yyy).

If only there was a function that could split a string by keying off characters.

Oh wait there is....

I decided to give it a comment memorial.

Comments
  • 2
    You're still using perl? *glaring eyes* or are you moving perl code to php or something?
  • 2
    I am wondering the same. And if you are working solely in perl how is it? I always wanted to work with perl and only had little exposure to it at work.
  • 6
    @AleCx04 perl is pretty cool. It's just something you have to get used to. if you are usually using php the switch won't be too hard
    Overall I guess perl is more fexible in certain things than php is but I stand corrected
  • 5
    I fucking love the idea of „comment memorials“
  • 0
    will your split also work when you input something like "as/sf/uk no:ob:11" or do you need to iterate over every element to do a typecheck? ;)
    because that regex solves two problems in one line actually
  • 2
    @kargaroth Actually all that's happening with that data is that it is split so the time and date can be displayed in different locations.

    The regex is complete overkill for a solution that can be done in one line call to split.
  • 2
    @Bl00D4NGEL It's in the roadmap for us to move to something newer for that part of our product. But yes we still use Perl in some instances.

    To be fair it was a good choice back in the day when they originally picked it.

    Aaannd now here we are in 2017.
Add Comment