- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to split a string separated by a dot in perl?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-01-2004 06:46 AM - last edited on тАО07-06-2014 05:34 PM by Lisa198503
тАО06-01-2004 06:46 AM - last edited on тАО07-06-2014 05:34 PM by Lisa198503
I have a string, say, First.Last and want to split it on the dot. I use the following perl code:
($First,$Last) = split "." , $string;
I have also used:
($First,$Last) = split '.', $string;
And:
($First,$Last) = split /./, $string;
And have put parens around it:
($First, $Last) = split (".", $string);
But I get nothing! If the string is separated by any other character (comma or slash) it works! How can I split on a dot?
Thanks for your help!
jls
P.S. This thread has been moved from HP-UX>System Administration to HP-UX > languages. -HP Forum Moderator
Solved! Go to Solution.
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-01-2004 06:54 AM
тАО06-01-2004 06:54 AM
Re: How to split a string separated by a dot in perl?
a34
apple
at
...
and so on.
so your dot may be getting interpretted as any character. Did you try escaping it with a backslash "\" ?
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-01-2004 07:11 AM
тАО06-01-2004 07:11 AM
Re: How to split a string separated by a dot in perl?
($First,$Last) = split "\.", $string;
It still does not work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-01-2004 07:25 AM
тАО06-01-2004 07:25 AM
Re: How to split a string separated by a dot in perl?
($First,$Last) = split '\.',"a.b"; seem to be working for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-01-2004 07:30 AM
тАО06-01-2004 07:30 AM
Re: How to split a string separated by a dot in perl?
I am really at a loss here. I need to be able to split on the dot. I hope someone out there can help me...
jls
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-01-2004 07:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-01-2004 07:43 AM
тАО06-01-2004 07:43 AM
Re: How to split a string separated by a dot in perl?
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-01-2004 07:56 AM
тАО06-01-2004 07:56 AM
Re: How to split a string separated by a dot in perl?
This works on HP-UX v11.11 and perl version 5.005_02
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-06-2014 04:12 AM
тАО07-06-2014 04:12 AM
Re: How to split a string separated by a dot in perl?
Thanks for example
Leslie