RE: Simple Split Question

2001-06-29 Thread Stephen Nelson
quot; DimView 2 "Some" DimView 3 "Most" DimView 4 "None" > > I want a hash with (1, "All", 2, "Some", 3, "Most", 4, "None") > > I'm spitting on /DimView/, but I can't get the syntax to throw it into the > hash correct. Can one of you thow me a couple of lines of code to get me > through this? > > Thanks, > > Scott > - Stephen Nelson "stephen" on PerlMonks (www.perlmonks.com) [EMAIL PROTECTED]

RE: using strict

2001-06-27 Thread Stephen Nelson
Fortunately or unfortunately, you can't print to files just by using $file as a filehandle. You need to open the file first. foreach $k (sort keys (%all_genes)) { for (1..5){ if ($k =~ /[$_]g/){ $file = "CHR$_"; ope

RE: checking groups on unix

2001-06-27 Thread Stephen Nelson
Since you're doing a string compare on $groupname, you need to use 'ne', not '!='. foreach my $file (@files) { #getgrpid returns the group file entry for a given group id. my $groupname = (getgrgid((stat($file))[5]))[0]; if ($groupname ne "groupname") {

RE: Re[2]: A better way?

2001-06-26 Thread Stephen Nelson
Actually, calling a subroutine with an ampersand and no parens does not call the subroutine with no arguments. (To make it clear, though, I AGREE with Jos I. Boumans' larger point, just correcting a smaller point that I think makes his point even more clearly...) Using the ampersand without passi

RE: array slice question

2001-06-26 Thread Stephen Nelson
Well, if you're OK with printing the colons in the last field, you could simply say: print ( ( split(/:/, $_, 9) )[1,6,8] ); Since that'll absorb all of the ending fields into the ninth (from zero, so index 8) field. That would be the correct thing to do if the colons in the ending field are not

RE: environment-Variable from korn-schell to perl

2001-06-26 Thread Stephen Nelson
You can execute the korn-shell script internally by using system(). ## The perl script use strict; $ENV{'PASSED_FROM_PERL'} = 'Hello, ksh!'; system('ksh', 'kornscript.sh') == 0 or die "system returned ", $? << 8, "from ksh kornscript.sh; stopped"; - ## kornscript.sh echo "Passed from Perl