|
||||||
| Perl Discussion for the PERL language - Practical Extraction and Reporting Language, is a programming language often used for creating CGI programs. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
When I try to split by a plus using this code:
Code:
@segments = split("\+", $n);
I have checked and $n is actually a value with many plus marks in it. Anyone know how to fix this???? |
| Sponsored Links |
|
|
|
|||||
|
I'm not sure if those two methods work but I did try this:
Code:
@segments = split('\+', $n);
__________________
CodeCall Blog | CodeCall Wiki | Shareware Site | Linux Forum | Write a Blog The CodeCall Wiki is now fully integrated with vBulletin users! Check it out and add some new pages! |
|
|||
|
the problem is when you use alternative delimiters for a regexp instead of the default / / you should almost always add the "m" (or other operator) to the beginning of the regexp so perl is clear on what is happening:
@segments = split(m"\+", $n); the first argument to split is a regular expression, not a string. So use / / unless there is a reason to use alternative delimiters. I think the single-quotes are recognized and supported by perl to emulate awk syntax. But any other delimiters besides // must include the operator. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Splitting... | Chan | C# Programming | 3 | 08-06-2007 08:41 AM |
| Splitting Strings with Empty Separator (Python) | Matt | Python | 3 | 05-18-2007 01:27 PM |
| WingedPanther | ........ | 2753.6 |
| Xav | ........ | 2704 |
| Brandon W | ........ | 1702.32 |
| John | ........ | 1207.73 |
| marwex89 | ........ | 1175.24 |
| morefood2001 | ........ | 966.05 |
| dcs | ........ | 655.75 |
| Steve.L | ........ | 475.59 |
| orjan | ........ | 418.58 |
| Aereshaa | ........ | 383.54 |
Goal: 100,000 Posts
Complete: 98%