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

Search results for query: *

  • Users: nfaber
  • Order by date
  1. nfaber

    Am I referencing de-referencing properly?

    I was reading the adding multiple value to a hash thread and I checked out the perldoc and I was wondering if this code is ok: my @ticTblCnts = (); my $tableIndex = 0; foreach my $loc (@out_locations) { foreach my $crit(@out_priorities) { foreach my $ty (@out_types) { my $combin =...
  2. nfaber

    Default to ")" if undefined

    Yup, that was it Paul. I tried to get cute and initialize all my counters in the same line. Sometimes we should leave well enough alone. my $changes = 0; my $power = 0; my $telco = 0; my $application = 0; my $server = 0; my $other = 0; I got a Biz Degree! How the h*ll did I get here?
  3. nfaber

    Default to ")" if undefined

    ')' was a misspell. I thought the same thing but the counting must be setting them to undefined. I got a Biz Degree! How the h*ll did I get here?
  4. nfaber

    Default to ")" if undefined

    I've been playing with some code to assign a zero to a variable if undefined but it is not working. This is excerts from a larger program. my ($changes,$telco,$application,$server,$other) = 0; foreach $res_anal_code (@res_code) { if ($res_anal_code =~ /customer/i){$changes++;} elsif...
  5. nfaber

    When to use eq and ==

    A little confusion here I see. Paul, you say both, does that mena either eq or == will work? I got a Biz Degree! How the h*ll did I get here?
  6. nfaber

    When to use eq and ==

    Ok Paul...how about this one: my $date = "03-20-2005"; my ($month,$day,$year) = split (/-/, $date); Is $month an integer or string? I got a Biz Degree! How the h*ll did I get here?
  7. nfaber

    When to use eq and ==

    Hello all, How can I tell for sure if the variable I am operating on is a string or an integer? Can't 01 also be a string "01"?? Thanks I got a Biz Degree! How the h*ll did I get here?
  8. nfaber

    Logic Problem

    Thanks Michael, thats what I did. Nick I got a Biz Degree! How the h*ll did I get here?
  9. nfaber

    Generating a chart

    IC! @{$h{$k}}{@types} = map {defined($_)? $_: 0} @{$h{$k}}{@types}; "if" defined($_) ? "then" map $_ to our array "else" map a 0. nice. Nick I got a Biz Degree! How the h*ll did I get here?
  10. nfaber

    Generating a chart

    Thanks Mike, Took your advice and now $type is $thing. Studying map. I see how this works: my @words = map { s/[.,!\?]\B//g; split; } <FILE>; map returns a list, so you will usually assign it to some type of array or hash. In this example map is a loop that runs two commands on <FILE> the...
  11. nfaber

    Generating a chart

    Thanks Mike, It does not seem to matter. This works: my ($type, $cri) = split /,/; $h{$type}->{$cri}++; and this works as well: my ($cri, $type) = split /,/; $h{$cri}->{$type}++; Both give (not based on the above exact data, but the format is...
  12. nfaber

    Logic Problem

    Tony, That is not all my code. There are alot of "next unless" and "if" staments in each loop, but they do not apply to my logic problem and I did not want to complicate the code needlessly. You are right about the closing braces. I just cut and pasted the applicable code. The braces are in...
  13. nfaber

    Generating a chart

    Ok...I believe I got it. I just swapped the $cri and $type: my %h; my @types = qw(critical warning normal); foreach (@type_chart) { chomp; my ($cri, $type) = split /,/; $h{$cri}->{$type}++; } print LOG "Problem Types and counts\n\n"; #print LOG "devType, critical...
  14. nfaber

    Logic Problem

    Thanks for the replies. Tony, The difference is in the: #Set defaults since a match was not found. This represents the code that sets default values for each variable from the device loop split. Mlibeson, If I remove the "last;" from both loops, a record is generated for each entry in the...
  15. nfaber

    Logic Problem

    A while ago I posted a question about a loop in a loop. Here is the basic structure: foreach (@problem) { my ($company, $logical_name, $numberprgn, $assignment, $uis_elapsed_start_time, $close_time, $res_anal_code,$user_priority, $severity_code ) = split (/,/)...
  16. nfaber

    Generating a chart

    Ok, with my code posted above: my %h; my @types = qw(critical warning normal); foreach (@type_chart) { chomp; my ($type, $cri) = split /,/; $h{$cri}->{$type}++; } print LOG "Problem Types and counts\n\n"; #print LOG "devType, critical, warning, normal\n"; print LOG...
  17. nfaber

    Generating a chart

    Mike, Please disregard privious post. I am still testing. I got a Biz Degree! How the h*ll did I get here?
  18. nfaber

    Generating a chart

    Thanks for all the replies. The reason I was leaning to Kevin's code is because I understood what he was doing. I try not to use code I do not understand anymore. That being said, I see what you are doing Mike, excepts for this line: @{$h{$k}}{@types} = map {defined($_)? $_: 0}...
  19. nfaber

    Generating a chart

    Thanks Kevin and Mike. I already used Kevin's code in my script and I DO need to: How can I do that using Kevin's code? Thanks, Nick I got a Biz Degree! How the h*ll did I get here?
  20. nfaber

    Generating a chart

    Hello all, I am in the process of writing some code that generates a chart. I can probably figure this out, but I though someone might have some ideas on an easy way to do this and want to poke at some code on a Sunday. The chart needs to look like this: troubleNumber chart: devType...

Part and Inventory Search

Back
Top