• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 194
  • Last Modified:

Splitting Strings

Hell0!

I'm trying to split one string into two strings using "|" as the mid-point.. example:

"first_name|First Name:"

i'd like something like->

$id = "first_name"
$lbl = "First Name:"

--------------------------
shouldn't be too hard ;)
--------------------------
0
tampabay420
Asked:
tampabay420
  • 3
1 Solution
 
pjedmondCommented:
$line="abcdefg|12345678";

($id,$lbl)=split(/\|/,$line);

print "$id - $lbl \n";

is probably what you want?
0
 
pjedmondCommented:
Basically splits the string at any | symbols and allocates them directly to the variables you require:)
0
 
tampabay420Author Commented:
dude, you are the man (or woman?), thanx for the help- here are those points i promised!
0
 
pjedmondCommented:
NP :)
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now