LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-09-2004, 06:20 AM   #1
raven
Member
 
Registered: Dec 2001
Location: Basel, Switzerland
Distribution: ubuntu
Posts: 297

Rep: Reputation: 31
perl problem


Hello

I am totally new to perl and i was trying to split a string expression at specific characters with the following command:

@table=split(/./, "this.is.a.test");

as a result i get an array with 1 entry, which contains the whole string. So somehow the line wasnt splitted.

Hows that?

I didnt define any use stuff at the beginning of my perl script, did I left out something? I also didnt declare @table to be an array, the first init it in that line above.

I am totally confised, according to the docs I found on the net, the line above should give me what I want...

Thanks

raven
 
Old 02-09-2004, 07:18 AM   #2
Gnuru
Member
 
Registered: Jan 2004
Posts: 53

Rep: Reputation: 15
Your problem is the regexp. '.' means match any character.

To get it to work, you need to escape '.'.

Try this instead:

@table=split(/\./, "this.is.a.test");
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
perl problem JJX Programming 1 10-10-2005 07:48 AM
Problem with perl module for w3c validator to work on my local Apache+PHP+perl instal tbamt Linux - Software 0 12-16-2004 05:37 PM
perl(Cwd) perl(File::Basename) perl(File::Copy) perl(strict)....What are those? Baldorg Linux - Software 1 11-09-2003 08:09 PM
perl problem? apache problem? cgi problem? WorldBuilder Linux - Software 1 09-17-2003 07:45 PM
Perl Problem ShadowPeo Linux - Software 2 02-08-2003 05:29 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration