How do I append an element to a perl array? - Dave's Brain
文章推薦指數: 80 %
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
延伸文章資訊
- 1Using the Perl push() function
You can use the push function to add new elements to the end of an array. Example 1. Adding an it...
- 2How do I append an element to a perl array? - Dave's Brain
Date: 2014nov11 Language: perl Q. How do I append an element to a perl array? A. Use push() like ...
- 3Arrays - Learn Perl - Free Interactive Perl Tutorial
Perl array variables store an ordered list of scalar values. ... push(@array, element) : add elem...
- 4Appending One Array to Another - Perl Cookbook [Book]
Appending One Array to Another Problem You want to join two arrays by appending all the elements ...
- 5Adding elements to an array in Perl - Stack Overflow
I have this code where I want to add 10, 11 and 12 to array arr. my ...