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 derfloh 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: blues77
  • Order by date
  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

    ...does not exist. Please create this file first and then run this script\n"; exit(); } while (<SOURCE>) { chomp; $_ =~ s/ //g; if($_ =~ m/:\s*(.+)\s*\(.+\."(\w+)""(\w+)/) { print "Extracting information for $_\n"; print LABELS "$1\n"; print TABLES "$2\n"; print COLUMNS...
  5. blues77

    Regular expressions

    ...$ARGV[0]); open(LABELS, "labels.txt"); open(TABLES, "tables.txt"); open(COLUMNS, "columns.txt"); while (<SOURCE>) { chomp; if($_ =~ m/:\s*(.+\b)\s*\(.+\."(\w+)"+(\w+)/) { print "Label = $1\n"; print "Table = $2\n"; print "Field = $3\n"; } } $_ = 'Column : Indv Clt Id...
  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

    ...I want to extract the portions Indv Clt Id V01TPRL_RLT_CLT INDV_CLT_ID At the moment my regular expression looks like this $_ =~ /Column\s*:\s*(.+)\s*\("COMP"\."(.+)""(.+)"/ This is the output being captured by this expression. Label = Indv Clt Id Table = TPRFL_RLT_CLT Field =...
  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

    ...$flag = 0; my $view = 0; my $noCAASsource = 0; open(MY_FILE2,$ARGV[1]); while(<MY_FILE2>) { chomp; my $line2 = $_; if($line2 =~ /^\s*$/) { #do nothing } elsif($line2 =~ /^($line1)\s+/) { if($line2 =~ /^($line1)\s+CAAS.+\.([^.]+)\.([^.]+)/ ) { $flag = 1...
  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

    ...$flag = 0; my $view = 0; my $noCAASsource = 0; open(MY_FILE2,$ARGV[1]); while(<MY_FILE2>) { chomp; my $line2 = $_; if($line2 =~ /^\s*$/) { #do nothing } elsif($line2 =~ /^($line1)\s+/) { if($line2 =~ /^($line1)\s+CAAS.+\.([^.]+)\.([^.]+)/ ) { $flag = 1...
  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...
  16. blues77

    Lost among hashes of arrays

    ...$flag = 0; my $view = 0; my $noCAASsource = 0; open(MY_FILE2,$ARGV[1]); while(<MY_FILE2>) { chomp; my $line2 = $_; if($line2 =~ /^\s*$/) { #do nothing } elsif($line2 =~ /^($line1)\s+/) { if($line2 =~ /^($line1)\s+CAAS.+\.([^.]+)\.([^.]+)/ ) { $flag = 1...
  17. blues77

    Add a another value to a key in a hash

    Ok I've made some more modifications and the error I was getting is gone but has been replaced by. Bareword "search" not allowed while "strict subs" in use at extract_label.pl line 102. Execution of extract_label.pl aborted due to compilation errors. I changed how the hash should be printing...
  18. blues77

    Add a another value to a key in a hash

    ...$flag = 0; my $view = 0; my $noCAASsource = 0; open(MY_FILE2,$ARGV[1]); while(<MY_FILE2>) { chomp; my $line2 = $_; if($line2 =~ /^\s*$/) { #do nothing } elsif($line2 =~ /^($line1)\s+/) { if($line2 =~ /^($line1)\s+CAAS.+\.([^.]+)\.([^.]+)/ ) { $flag = 1...
  19. blues77

    Add a another value to a key in a hash

    How is that done?
  20. blues77

    Add a another value to a key in a hash

    Hello, Right now I have a hash with keys that have values but if I want to add another value to the hash key it overwrites the value already stored there. Is there anyway to make it so that I can store more than one value for a particular key? Below is the code that I have currently...

Part and Inventory Search

Back
Top