Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: varaible to filehandle -alack!

by Crackers2 (Parson)
on Oct 28, 2010 at 20:19 UTC ( #868139=note: print w/replies, xml ) Need Help??

in reply to varaible to filehandle -alack!

I suspect you want something like this:

use strict; open my $ALUS, "Z:\\3\' UTR intron project\\Alu_bed.bed" or die "Coul +dn't open alus: $!"; my %seen; while (<$ALUS>){ /(chr.*?)\t/ or next; if (! exists $seen{$1}){ open my $fh, ">", "Z:\\3\' UTR intron project\\Alu_chroms\\$1.tx +t"||die "couldn't open $1 file!"; $seen{$1} = $fh; } print {$seen{$1}} "$_"; }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://868139]
[marioroy]: bad gurus :)
[choroba]: also, &> redirects both at the same time
[marioroy]: erix are you using csh
Discipulus uh the link was for cmd.exe the bash one
[marioroy]: If yes, for redirection to work, one might do the following
[marioroy]: `bash -c "clang --version 2>/dev/null"`
[choroba]: Sane people don't use csh
[marioroy]: the 1>&2 will work, not shown
[marioroy]: sorry, did not know which if cmd.exe or unix (bash)
[choroba]: csh considered harmful

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2017-03-23 08:21 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (284 votes). Check out past polls.