in reply to Re^2: arrays and foreach
in thread arrays and foreach
Instead of push(@userData, "$id1;$eID;$epID;$sid1;$idD;$idL");, may I recommend
orpush(@userData, join(";", $id1, $eID, $ipID, $sid1, $idD, $idL), );
orpush(@userData, [ $id1, $eID, $epID, $sid1, $idD, $idL ], );
push(@userData, { id => $id1, externalId => $eID, externalParentId => $epID, sid => $sid1, domain => $idD, lockedTimes => $idL, }, );
The first alternative makes it easier to change the delimiter, not repeat yourself, etc. The second allows you to avoid the split later on in your code. The third documents (for some definition of documentation) the structure that you are using.
Depending on your needs, one of these may be more appropriate.
--MidLifeXis
|
|---|