Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Split Function 1

Status
Not open for further replies.

pcredskin7

Programmer
Aug 11, 2009
2
US
I am having trouble splitting a string that is delimited by the '^' character. Could somebody please point me in the right direction?

Below is one of the many methods I have tried thus far:

my $temp = "mary^had^a^little^lamb.";
my @vals = split('^', $temp);


Thanks.
 
The first argument to split() is a regexp, not a string. Even using single-quotes does not make it a string, so you have to escape special characters like ^.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top