my $data = join '',
"U|(Memory is incorrectly balanced between the NUMA ",
"nodes of this system, which will lead to poor performance. ",
",__REFERAL__file:__SELF__;( for details on your current ",
#(my $m_type = $data) =~ s/^((?:U|M))\|.*$/$1/; # gets U
#(my $p_list = $data) =~ s/^(?:U|M)\|(.*)$/$1/; # gets U, i think thi
+s is the reason you weren't getting anything
# This approach does what I think you are trying for without as much w
+ork for you or the computer.
my ($m_type, $p_list) = split /\|/, $data, 2;
my @sub_p_tmp = split /;/, $p_list;
print "MTYPE: $m_type\n";
print "PLIST: $p_list\n";
# Try using
# for my $p_tmp ( @sub_p_tmp )
# Instead of the c style for loop, unless you are processing HUGE arra
for ( my $i = 0; $i <= $#sub_p_tmp; $i++ )
print "$i: $sub_p_tmp[$i]\n";
# Here's your regex based method fixed to work
# if ( $sub_p_tmp[$i] =~ m/^\(([^)]*)\),([^,]*),(.*)$/ )
# @args = ($1, $2, $3);
# print "\nArgs:\n";
# print Dumper(\@args)."\n";
# Here's a split based approach.
# in both approaches @args is overwritten each pass through the loop.
my @temp = split /,/, $sub_p_tmp[$i];
if ( @temp )
# Get rid of the extra parens.
$temp =~ s/^\(|\)$//g;
# Overwriting the value of @args each time.
# Do you mean
# push @args, @temp[0..2];
# push @args, [ @temp[0..2]];
$temp =~ s/^\(|\)$//g;
@args = @temp[0..2];
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||