I am a beginner in perl, working in a simple project. I did some code to connect a database and export the data to a CSV file, however, it was working fine but now when exporting the data the first column (for example "Person_ID") list in a sequence number (1 2 3 ...) instead of the original values (10 12 21 ...) then the rest of the columns are fine.

Sounds like your 'Person_ID' column doesn't hold the exact values that you expect and if that's the case, you'll need to look into how the records were inserted and the definition of the persona table structure.