How do I append an element to a perl array? - Dave's Brain

文章推薦指數: 80 %
投票人數:10人

Date: 2014nov11 Language: perl Q. How do I append an element to a perl array? A. Use push() like this: push(@a, 'new element');. Dave’sBrain Home Search Browse Recent Keywords Othersites Feedback Signin Random Crawlers ProgrammingTips-HowdoIappendanelementtoaperlarray? Date:2014nov11 Language:perl Q.HowdoIappendanelementtoaperlarray? A.Usepush()likethis: push(@a,'newelement'); Notethatpush()worksin-place.SodoNOTdothis: @a=push(@a,'newelement'); #WRONG,WRONG,WRONG



請為這篇文章評分?