User Profile

Collapse

Profile Sidebar

Collapse
KennB
KennB
Last Activity: Jun 13 '13, 04:16 PM
Joined: Jan 6 '13
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • KennB
    replied to How to do a quicker array replace
    in Perl
    update on my reply

    @temp = map { $_ =~ s/cats/dogs/g; $_ } @temp;

    I think that what is happening is that, if a substitution occurs, the $Count value for the number of substitutions gets placed into @temp. Otherwise, a null value gets inserted. And for some reason, the original array gets the replacement changes.

    My solution was to make a copy of the original array and a third copy to receive the $Count values....
    See more | Go to post

    Leave a comment:


  • KennB
    replied to How to do a quicker array replace
    in Perl
    @temp = map { $_ =~ s/cats/dogs/g; $_ } @temp;

    I think that what is happening is that, if a replacement occurs, the value '1' gets placed into @Temp. Otherwise, a null value gets inserted. And for some reason, the original array gets the replacement changes.

    Romano
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...