in reply to Seperating values with spaces in array

Where are you stripping leading zeroes? Or where are you adding the leading zeroes?

Also, where is JSON coming into this problem?

Is your input data maybe CSV? Maybe you want to use Text::CSV_XS?

  • Comment on Re: Seperating values with spaces in array

Replies are listed 'Best First'.
Re^2: Seperating values with spaces in array
by RuZombieSlayer (Novice) on Jan 17, 2016 at 11:50 UTC
    the JSON is for later dont worry about that. The txt file has a list of numbers "001, 002, 003.... Those leading zeros are fine as a string but are removed when turned into numeric data in the array.

      Perl does not magically turn strings into numeric data when putting them into an array. Maybe your problem happens when you output the data?

      Please show us some problematic input data and the output you get when you run your program as you have posted it.