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!

Recent content by blues77

  1. blues77

    Writes to frile not being committed

    Yeah you are right. Thanks for the suggestions and you're help!
  2. blues77

    Writes to frile not being committed

    I figured it out. I needed to put a > before the filename when opening it.
  3. blues77

    Writes to frile not being committed

    Yeah it's not writing to the file. I added the text "This is a test" to the labels.txt file and ran the script, which should have overwritten the contents of the file but the text I entered is still there.
  4. blues77

    Writes to frile not being committed

    Hello, I'm trying to write to some text files but it doesn't appear to be writing to the files UNLESS I use the >> operator (append operator) when opening the file. Can anyone tell me what is going on? Below is my code which writes fine when I use the >> operator. If I remove it though...
  5. blues77

    Regular expressions

    Thanks for your help rhash. I tried your regular exression alone and it works fine however when I use your expression in my code I'm still having the same problme. Here is my code. Any ideas on why this isn't working? I'm very perplexed. use strict; open(SOURCE, $ARGV[0]); open(LABELS...
  6. blues77

    Regular expressions

    I wish it did. But it should be assigning the string V01TPRL_RLT_CLT to the $2 variable but what I'm getting when I print out this variable is TPRFL_RLT_CLT. It's missing the V01.
  7. blues77

    Regular expressions

    Hello, I'm having a little trouble creating a regular expression to extract some information from a string. Given the string Column : Indv Clt Id ("COMP"."V01TPRFL_RLT_CLT""INDV_CLT_ID") I want to extract the portions Indv Clt Id V01TPRL_RLT_CLT INDV_CLT_ID At the moment my regular...
  8. blues77

    Lost among hashes of arrays

    Yeah that does help. So using this technique if later I encounter the same key with the same value when it tries to add the key with the code $hash{$2}{$3} = 1; nothing wil be added because the value already exists. Is this correct? This is a nice little trick thanks!
  9. blues77

    Help! Hash of arries can only hold done value per key

    It's working perfect now. Thanks to all of youu for all your help. Here is the final code. Feel free to make any suggestions on how to make things more efficient. Thank you! #use strict; #print "$ARGV[0]"; open(MY_FILE1,$ARGV[0]); open(OUTPUT, ">>output.txt"); while(<MY_FILE1>) {...
  10. blues77

    Help! Hash of arries can only hold done value per key

    That's exactly what I'm trying to do. I tried your suggestion but I'm stillonly getting one value per key/value pair in the hash. Once the ky in the hash has a value stored any subsequent value with the same key designation will not be entered into the hash becuase i think it's being caught by...
  11. blues77

    Help! Hash of arries can only hold done value per key

    Can anyone tell me from looking at the code below why I'm only able to have one value per key in the hash despite using a hash of arrys. Below is my code. Any suggestions are appreciated. It seems from what I can tell that the code doesn't enter the part elsif (exists $hash{$2})...
  12. blues77

    Lost among hashes of arrays

    I noticed another strange behavior. in the code if($line2 =~ /^($line1)\s+CAAS.+\.([^.]+)\.([^.]+)/ ) { $flag = 1; if (exists $hash{$2}[$3] ) { print "key value pair already exists for elemetn $line1\n"; #do nothing } elsif (exists $hash{$2}) {...
  13. blues77

    Lost among hashes of arrays

    Ok here is what I have now but it still doesn't appear to be adding more than one value for a particular key. [cod] if($line2 =~ /^($line1)\s+CAAS.+\.([^.]+)\.([^.]+)/ ) { $flag = 1; if (exists $hash{$2}[$3] ) { #do nothing } elsif (exists $hash{$2}) {...
  14. blues77

    Lost among hashes of arrays

    The exists function you suggested looks like it will only check for the existance of the key in the hash. Will this also check for the existance of a key/value pair even when a key may have multiple values since I will be using a hash of arrays.
  15. blues77

    Lost among hashes of arrays

    Hi thanks for the tips. I understand what you're saying. The reason why I did it that way was becuase I'm reading my values from a text file that might look like this. abc keyA.12 efg keyB.17 abc keyA.12 abc KeyA.22 The string abc in this example appears twice. The...

Part and Inventory Search

Back
Top