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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do you split on a / ?

Status
Not open for further replies.

networkwoes

Technical User
Aug 17, 2001
13
US
I need to split a date into three parts... month day year. The date currently is in this format 10/12/01 and I am trying to use the slpit command, but do not know what the correct syntax is to tell it split on the /.


$PsaDate = split( /(/)/, $Temp[1] );


I know this is an easy one, but I simply cant find it in any documentaion for some reason.


Thanks for your help in advance!
Eric

 
($month, $day, $year) = split( /\//, $Temp[1] );

The split function accepts a regular expression as the first argument, so you have to escape (put a backslash in front of) special characters like the forward slash in order for them to be interpreted correctly.

Hope this helps.

--Jim
 
FYI split also can use quotes for a delimiter like:
($month, $day, $year) = split( "/", $Temp[1] );
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top