foreach my $customProf (@{scalar2array($Settings->{custom_plots}[$i][$t]{profiles})}){ if(exists $profEvntVar->{$customProf}){next;} my ($evnt_nums_ref,$var_names_ref,$variables_ref,$last_evnt_name) = getvars($customProf); $profEvntVar->{$customProf}{events} = $evnt_nums_ref; #Link profiles with their respective events $profEvntVar->{$customProf}{times} = $evnt_times_ref; #Link profiles with their respective events $profEvntVar->{$customProf}{vars} = $var_names_ref; #Link profiles with their respective variables $profEvntVar->{$customProf}{varsref} = $variables_ref; #Link profiles with their respective variables $profEvntVar->{$customProf}{lastEvent} = $last_evnt_name; #Link profiles with their respective variables } sub getvars{ my $profile = shift(@_); my @ptk_info = ``; my $evnt_nums_ref; my $events_found = 0; my $vars; my $prof_var_names; my $last_evnt_name; foreach (@ptk_info){ if(/^\s*(\d*\.\d*)0\s-\s(.*?)\s*$/){ $evnt_nums_ref->{$2} = $1; $last_evnt_name = $2; } if($events_found == 1 && /^\b/){ push( @{$vars}, split(" ") ); } elsif($events_found == 0 && /^Events$/){ $events_found = 1; } } foreach (@{$vars}){ if(/(.{1,8})\S*:\S*/){ $prof_var_names->{$1} = $_; } else{ $prof_var_names->{$_} = $_; } } my @sorted_vars = sort { lc($a) cmp lc($b) } @{$vars}; return $evnt_nums_ref,$prof_var_names,\@sorted_vars,$last_evnt_name;