I need to insert a identifier number along with city records into a database table ( data is read from a file and inserted into a table using perl) such that certail records that belong to same city get the same number ...for e,g if the records are all for city "Boston" then they all should have number 1 and this number one is inserted into a table ...for if there are five records for Boston then number one is inserted five time for each row of Boston....if records for New York appear only once then it shoud get a new number lets say 2 and should be inserted just once with identifier number as 2 ..and so on...( it is assumed that all same city records appear together in the file which is read...)
I do not know how can in perl if we can write one function which on calling should give me a new number statring from number 1 (for the very first time the function is called ) then on the next call it should return 2 etc....I am planning to call that function only when I see the city is changed to a new one.....
I hope there is a easy way out....
I do not know how can in perl if we can write one function which on calling should give me a new number statring from number 1 (for the very first time the function is called ) then on the next call it should return 2 etc....I am planning to call that function only when I see the city is changed to a new one.....
I hope there is a easy way out....