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 strongm 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: *

  1. ericse

    Sort hash ref values?

    :) Thanks guys. I have it working now. Appreciate the info.
  2. ericse

    Sort hash ref values?

    Thank you. That makes sense. I'll let you know if it works :)
  3. ericse

    Sort hash ref values?

    Hello, I was wondering if anyone could help me sort a hash by values. Essentially my structure is this: $hash = { id1 => { 'company' = value, 'units' = value, 'url' = value, }, id2 => { 'company' = value, 'units' = value...
  4. ericse

    Comparing hash structures?

    Hello all, I'm trying to compare hash structures and return the unique values of each hash. my $hash1 = { 'add' => { 'val1' => 1, 'val2' => 1, 'val3' => 1 }, 'remove' => { 'val4' => 0, 'val5' => 0...
  5. ericse

    GREPing large amounts of data.

    Well. I have 300 different config files. Right now, the easiest way to get my answer is something like this: my @results = `grep -c 'HidePrivacyStatement] t' /some/file/here.config`; foreach (@results) { if ($_ =~ /1$/) { $cnt += 1; } } print "$cnt\n"; But this seems costly do...
  6. ericse

    GREPing large amounts of data.

    Hi all- I'm basically trying to write a script that will generate statistics for each configuration setting we have in our application. There is about 70 settings. There's about 300 configuration files. I need to generate reports for each of the 70 settings. Basically: Setting A is "true" for...
  7. ericse

    Recursion?

    Miller- Looks like I was on the right track :) I posted that seconds after you posted your response. Which is good--at least my thinking is on the right track. Thanks for the notes. Also, thanks for not just telling me how to do it :) This is far more helpful then I could express to you...
  8. ericse

    Recursion?

    Miller, Hmmm. I guess I'm assuming that @keys will be defined, and I'm also assuming the $ref is a hash ref (although that seems a little less important). Then, if I believe what I just wrote to be true, my first test should deal with whether or not @keys holds any data. At that point, I...
  9. ericse

    Recursion?

    Hi Miller- Actually, it's not for homework. I was recently hired into the technology department at my company. Having no formal experience in programming (it was a hobby of mine for a long time) the lead developer assigns me tasks that he thinks will be beneficial for me to learn in order to...
  10. ericse

    Recursion?

    Ok, so that second post won't work for beacuse it isn't incrementing the hash ref: sub nested_exists { my ($ref, @keys) = @_; if (exists $ref->{$keys[0]}) { my $new_ref = $ref->{$keys[0]}; nested_exists(\$new_ref, shift(@keys)); } else { return 0; }...
  11. ericse

    Recursion?

    I've come up with this, but I know it won't work... But this is similar to what I want done: sub nested_exists { my ($ref, @keys) = @_; if (exists $ref->{$keys[0]}) { nested_exists(\$ref, shift(@keys)); } else { return 0; }; return 1; } Thanks
  12. ericse

    Recursion?

    Hi guys- I'm trying to test whether nested hash refrences exist, like so: my %ref = ( 'app' => { 'next' => { 'further' => 10 } } ); if (nested_exists(\%ref, 'app', 'next', 'further')) { do whatever..... } sub nested_exists { my ($ref, @keys) = @_; .....i just...
  13. ericse

    Get all child elements within a DIV?

    Hey guys, I wasn't actually using 'id' heh, I just used that as an example because I was lazy and didn't want to type out the *real* id.. Anyway, I got it to work using getElementsByTagName("*") so thanks for the help :)
  14. ericse

    Get all child elements within a DIV?

    Hey guys- I can't seem to do this. Everything I try fails. I have the ID of the Div... and I create controls dynamically within that div. I want to change the styles of those elements within the div. How can I do this? I've tried: var children = document.getElementById('id').getChildren()...
  15. ericse

    regex to grab file name from path?

    Thanks Kevin. I also made it work for *nix file systems as well: $name = ($name =~ /[\\\/]([^\\\/]+)$/) ? $1 : $name; :) Thanks again, ~Eric
  16. ericse

    regex to grab file name from path?

    Hi guys- Here's what I have thus far: #!/usr/bin/perl use strict; my $var = 'C:\Documents and Settings\blah\File-Upload1.doc'; $var = ($var =~ /\\([\w\- ]+\.[\w]+)$/) ? $1 : $var; print "$var\n"; Everything works. The only problem is *special* characters. If I add in support for all the...
  17. ericse

    Help with parsing a Perl file in Perl.

    Hi Miller- I've worked my way through most of the code, and I understand how it's finding the parenthesis and everything. I've been working on my own regex, to handle pulling out the first param.... my main question is, is it possible to do this in a similar way as the way you accomplished...
  18. ericse

    Help with parsing a Perl file in Perl.

    Nevermind. It works beautifully. The only thing it doesn't do, is grab nested gettext()'s from a gettext() function. This is a huge improvement though. Now I'm gonna play with the regular expression until I can figure it out. Again, thanks :)
  19. ericse

    Help with parsing a Perl file in Perl.

    Yea, I'm getting an error as well. I'm trying to work my way through it :)
  20. ericse

    Help with parsing a Perl file in Perl.

    Wow, I certainly wasn't expecting such a response. Thank you very much. Now I can spend the rest of the day trying to figure how that's supposed to work :) This sure proves I was doing things the wrong way. Thanks again, I truly appreciate your help. ~Eric

Part and Inventory Search

Back
Top