I an using split to break strings like these:
Resource Group: gr_shared_fs
rs_ipaddr (heartbeat::ocf:IPaddr): Started lapg2-a
rs_raid1_shared_fs (heartbeat::ocf:Raid1): Started lapg2-
rs_fs_shared (heartbeat::ocf:Filesystem): Started lapg2-
into blocks separated by space. Please note the white space in front of the rs_ starting strings (below "Reso" from the first line). That white space may or may not be there. I need to split the strings and I am using this:
my @statusLineFields = split(/\s+/, $statusLine);
but it seems if I do have that white space there the first element in @statusLineFields is whitespace. If the input lines do not have any leading space then the first element is some rs_ string. I really need to ignore that white space and have the first element be the rs_ string somehow.
I have the feeling this is a 1-line quick and easy answer but I've been running circles around my tail and couldn't figure it. In addition to this, once I split the line, the elements of that array (with or without the first one being whitespace) are surrounded by one blank space on each side. That "Started" is actually " Started ". Why is this and how do I get rid of it?