Using SPLIT function with a Period 
Author Message
 Using SPLIT function with a Period

Hi,
    I am very new to PERL and am tring to do the following

Perl does not like using a '.' period to split lileral - it works if I use a
':'.

What am I doig wrong

Hope some one can help,

Richard



Sun, 04 Jul 2004 17:31:30 GMT  
 Using SPLIT function with a Period

To match one of these, use a backslash (e.g. "\$" matches "$")

Quote:
> Hi,
>     I am very new to PERL and am tring to do the following


> Perl does not like using a '.' period to split lileral - it works if I use
a
> ':'.

> What am I doig wrong

> Hope some one can help,

> Richard



Sun, 04 Jul 2004 22:45:01 GMT  
 Using SPLIT function with a Period

Quote:

> Perl does not like using a '.' period to split lileral - it works if I use a
> ':'.

Try:

Because the . has special regular-expression meaning in Perl, you need
to "escape" it with the backslash. This says, "don't use the next
character for it's special meaning, use it literally."



Tue, 06 Jul 2004 02:31:54 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Using a period as a delimiter in the split() function

2. Using a period as a delimiter in the split() function

3. time period splitting

4. using split function twice on same line

5. ANNOUNCE: Time::Period - Evaluate a Time Point Relative to a Time Period

6. perlcc does not compile when split to array function is used

7. substitution:change a period into period-space

8. How to use split function to split on a backslash

9. Problem with join function (and split function)

10. PERLFUNC: split - split up a string using a regexp delimiter

11. Using split to return a @ without splitting on spaces

12. PERLFUNC: split - split up a string using a regexp delimiter

 

 
Powered by phpBB® Forum Software