Re: Perl 6.x , please offer PREPEND as well as APPEND



"Mr P" <MisterPerl@xxxxxxxxx> wrote:
> Dear Damian, Larry, et al:
>
> The asymetric PREPEND and APPEND should be addressed in 6.x:
>
> # append a string, very nice
> $song .= ' Her Majesty The Queen';
>
> # prepend a string - YUK, ugly, [1]
> $song = ' Her Majesty The Queen ' . $song;

Not only ugly, but also slow if $song is large. You can use the
four argument substr to (potentially) make it faster, but then it is
even uglier.

But I don't see a tremdous need for a new operator here. If you are doing
a lot of prepending, chances are you are doing something wrong, I'd think.

Xho

--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
.



Relevant Pages

  • Re: Parsing / " characters
    ... have the rest of the code to append the ... - JCL inserts that string at the start of every program, ... >>the code associated with that program - in exact order, ... >>Dim db As Database, tdf As TableDef ...
    (microsoft.public.access.externaldata)
  • Re: Parsing / " characters
    ... create a new record in table TTT containing the string ... >I can append ALL the records from the ... >Dim db As Database, tdf As TableDef ... >> Dim lngFN as Long ...
    (microsoft.public.access.externaldata)
  • Re: Fastest way to append text to a TextBox
    ... What's the fastest way to append text to a TextBox? ... CPU and, even if I limit the TextBox to just 30KB of text, it takes over ... Private Sub AppendText(ByVal sText As String) ... Dim iLen As Integer = .Text.Length + sText.Length ...
    (microsoft.public.dotnet.languages.vb)
  • RE: SaveWorkbookAsToday()
    ... Create a string variables for the day and convert your date to the format you ... Then append or concatenate the string date where necessary in the file name. ... Dim DateFormat As String ...
    (microsoft.public.excel.programming)
  • Re: Problem appending Objects to File
    ... // test ability to append to a serialized object stream ... * write some string objects to serialized file ... ObjectOutputStream oos = new ObjectOutputStream; ...
    (comp.lang.java.programmer)