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 Wanet Telecoms Ltd 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: ailse
  • Order by date
  1. ailse

    comparing the arrays in a hash of arrays

    ok - never mind - i seem to have cracked it myself, just had to dereference each of the arrays, check the size, and remove it from the hash if it was sized one or smaller :)
  2. ailse

    comparing the arrays in a hash of arrays

    sorry to resurrect this, but need some more advice if anyone can help out - of the two solutions above, I understood rharsh's better so i went with that, however my code now needs to only identify those "colours" that are associated with more than one id. so for my sample input above, i would...
  3. ailse

    comparing the arrays in a hash of arrays

    ok, have given this a go with my data - no joy so far :( this is how i'm populating my hash of arrays: open (FILE, "result.text") while( <FILE> ) { chomp; ## first split ids up from colours my ($id, $colours) = split('\t', $_, 2); ## now split colours into an array my @colour_list =...
  4. ailse

    comparing the arrays in a hash of arrays

    cool, i really needed a fresh perspective on the problem and you have provided just that :) will give this a try and see how it works out, thanks!
  5. ailse

    comparing the arrays in a hash of arrays

    hi all - got a bit of a tricky problem, not even sure if there is a way to do it, but i'll happily be proved wrong!! i have a hash of arrays, generated from a file that looks like this: id val val val id val id val val and so on. i have had no problem reading this file into a hash of...
  6. ailse

    array manipulation question

    thanks steve - but no, that's not quite what i was after, i didn't want the array to "loop round" as it were, so once the final value in the array is reached, the loop should stop. ishnid's suggestion has produced the output i wanted :)
  7. ailse

    array manipulation question

    awesome, thanks :)
  8. ailse

    array manipulation question

    Hi, I am trying to print an array such that each element is followed by the next one, with a tab character in between, and then a new line, so that: @array = ("a", "b", "c", "d"); will be displayed as: a b b c c d so far my code is: my $i; my @array = ("a", "b", "c", "d"); my...
  9. ailse

    using a hash to replace values in a file

    Thanks Steve, I'd never heard of this module before, I'll give it a go :)
  10. ailse

    using a hash to replace values in a file

    Hi, I am trying to use a hash as a lookup to replace 'placeholders' in a file. I have some raw data that I have read into a hash which looks like this: id1 val1 id2 val2 id3 val3 so the keys of the hash are the id's. I have another file which looks like this: enzyme: id1 interacts with...
  11. ailse

    pattern matching between two files

    I have two text files, one of which is a list of names and the other is the "main" file. What I am trying to do is read both files into arrays to that I can identify lines in the "main" file that contain any of the names in my list, and then return those lines from the main file. For example...
  12. ailse

    command line arguments

    thanks for that - tried it with quotes and it's worked how i want it to now :)
  13. ailse

    command line arguments

    Hi there, I am writing a small script to search a text database (data_file.txt) that I have already read into a hash of arrays. My command line should look like: ./search.pl -i data_file.txt -k search terms my problem is that there is usually going to be more than one word following the -k...
  14. ailse

    flat file database

    thanks everyone, for all your useful posts, have got it working great now :)
  15. ailse

    flat file database

    Hi, I have a text database in the following format: id uid short_name desc org where all five are tab-delimited. I am trying to read this into a hash of arrays, so that "id" is the key and an array consisting of fields 1 to 4 is the value for each row in my flat file. What I basically need...
  16. ailse

    searching a hash

    I have implemented a search of a hash using a keyword as follows: while ( my ($id, $description) = each(%hash) ) { if ($description =~ /$query_string/i) { print "$id" . "\t" . "$description"; print "\n"; } } my problem is to do with returning an error message if $query_string does...
  17. ailse

    problem with graph module

    hi, i'm not sure if anyone can help, as I am having a problem with a specific module - called Graph-0.74 (http://search.cpan.org/~jhi/Graph-0.74/) basically i am trying to use the Graph::AdjacencyMatrix module, for creating and querying an adjacency matrix and also a distance matrix. I can get...
  18. ailse

    how to append to the start of a file?

    Hi, I have some xml that I am processing using XML::Simple - my problem is that I am working with XML that needs two tags appending to the top and bottom of the document: my original file: <a tag> </a tag> <a tag> </a tag> what it should look like: <master tag> <a tag> </a tag> <a...
  19. ailse

    problem using join

    thanks to all, it was chomp that did the job :)
  20. ailse

    problem using join

    OK here is my current scenario - I have an input data file (test.txt) with pairs of nodes (tab-delimited) - G:1 G:2 G:4 G:5 G:7 G:4 G:9 G:10 G:12 G:7 I have a script to read this file and produce for each pair of nodes a statement to add the pair as an edge to a graph (thanks KevinADC!)...

Part and Inventory Search

Back
Top