User Profile

Collapse

Profile Sidebar

Collapse
minowicz
minowicz
Last Activity: Mar 14 '08, 07:21 PM
Joined: Feb 27 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • I realize this isn't exactly a perl answer, but why not simply:

    zgrep -vh ^ORA dirname/*.gz > bigfile

    or if you don't have zgrep:

    gzip -dc dirname/*.gz | grep -v ^ORA > bigfile

    As to having multiple directories, it is not clear if you want each to be processed in sequence and appended to the single bigfile, or if you want them each to be processed in parallel and put into their own...
    See more | Go to post

    Leave a comment:


  • Given this data:



    This line is going to cause one minor problem:



    In the case of a $osname that should be "sun os" you will get $osname of simple "sun" and the "os" will be discarded as a the 4th positional return from the split is not captured in your assignment.

    There are probably a few ways to solve this problem. Off the top of my head, the...
    See more | Go to post

    Leave a comment:


  • minowicz
    replied to Loop for application I wrote crashes
    in Perl
    Correct... I was overzealous with cut and past and too sparing with editing thereafter....
    See more | Go to post

    Leave a comment:


  • minowicz
    replied to Searching in Hashes
    in Perl
    Actually, I'm largely opposed to the idea of moving this to a database unless one of two conditions are true:
    1. The total size of the database is large enough that it will not readily fit into memory when all of the various indexes and such are considered along with the original data.
    2. The search semantics required are so elaborate, varied, and/or changing through the application life cycle that the OP is likely to have to reinvent the wheel
    ...
    See more | Go to post

    Leave a comment:


  • minowicz
    replied to Searching in Hashes
    in Perl
    OK, so to some extent, you really want to be able to query all sorts of possible matching situations against the data. Eventually, yes, you are going to end up wanting an SQL-like syntax to express searches. So you really need to stop and ask yourself how much farther your search semantics are going to evolve and if you're going to pass a point where the code your writing would have been better served with an SQL database. For simple searches,...
    See more | Go to post

    Leave a comment:


  • minowicz
    replied to Loop for application I wrote crashes
    in Perl
    tr/// works well with single letter search counting like this, but does not interpolate $base. So again, you'd have to split back out each count. It would however, be more efficient in the long run.

    Code:
    foreach my $base (@bases) {
         $counts[$index]->{$base} = ($line =~ s/$base//gi);
    }
    becomes

    Code:
    $counts[$index]->{G} = ($line =~ tr/G//gi);
    $counts[$index]->{A}
    ...
    See more | Go to post

    Leave a comment:


  • minowicz
    replied to Loop for application I wrote crashes
    in Perl
    I may be wrong, but from what I've seen from other folks with genetic sequence data they tend to have very large files with huge numbers of lines that they are processing. If that is the case for you, then you may well wish to avoid the previous code's suggestion of pulling the entire file into an array, as it will potentially consume a huge amount of memory.

    Also, the act of putting all this into a hash will ruin any chance of preserving...
    See more | Go to post

    Leave a comment:


  • minowicz
    replied to Renaming files
    in Perl
    Kevin's example code is correct in large part. It is only his misunderstand of your desire to create symlinks rather than renaming the files that is an issue. No doubt this was in large part due to the unfortunate choice of subject in the original post. Still his code stands up to the task. You'd simply need to change:

    Code:
    rename( "$path/$old_filename$ext", "$path/$new_filename" ) || die "Can't rename
    ...
    See more | Go to post

    Leave a comment:


  • minowicz
    replied to Searching in Hashes
    in Perl
    Perhaps that was a poor choice of words on my part. Still, I took the following:



    To mean that how the original poster intended to solve the problem was somehow deficient and far better served by using a database rather than a hash internal to the perl program. This may well be true, depending on the current and expected sizes of the database and the resources available on the machine that will be running the code....
    See more | Go to post

    Leave a comment:


  • minowicz
    replied to Convert Number to Word
    in Perl
    Condescending is exactly how I would have described the original response. Someone asked a simple question and was not told the answer, but instead berated for wasting the time of people on the forum by not bothering to have done due diligence. The irony was that the suggested path to due diligence was to search CPAN and the trouble to provide a link to the search required was gone to... But clearly the responder, a moderator on this forum, had...
    See more | Go to post

    Leave a comment:


  • minowicz
    replied to Searching in Hashes
    in Perl
    Actually, what you are trying to do is not so ill advised as some have tried to make out. It sounds like what you really want to do is search through your database for products that match a given title. A hash is a great way to search for things, but unfortunately, as has been mentioned, the hash keys need to be unique.

    The first possible work-around for this would be to simply use the product ID as your key. This gets you something...
    See more | Go to post

    Leave a comment:


  • minowicz
    replied to Convert Number to Word
    in Perl
    I always enjoy seeing the self-righteo, erm... helpful people post 'answers' like this.

    The CPAN Search you recommend above returns 415 results, of which the two most appropriate (in my own opinion) _real_ answers (Lingua::EN::Num bers or Lingua::EN::Num bers::Easy ) are not to be found on the first page of results. In fact, Linuga::EN:Numb ers::Easy does not show up until page 32, where it is the 315th result and Lingua::EN::Num bers...
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...