User Profile
Collapse
-
Actually I am making the array in my code and need two outputs, one is where I am outputting the actual array to a file, and I also needed the number count to be output to yet another file. I have been writing a large code to do a few different things, but the section of the code that applies to this question is below. When I try the $#ArrayName it outputs the a lot of 1s that add up to the total number of characters, not the number of lines.... -
Find out the number of lines in an array
I was wondering if there was a way to find out how many lines were stored in an array, and then to be able to have that number stored in an array itself. I've been googling and searching the forum but cant find anything that works for me. -
Ah, now I feel like an idiot, but thanks for all the suggestions guys, and especially thanks for your patience kevinadcLeave a comment:
-
My bad, here is the data:
...Code:662376 [S] |GCGG | | | 662375 [S] |CGCC | | | 662374 [S] |GCGG | | | 662373 [H] |CATC | | | 662371 [Y] |TCCC | | | 662369 [M] |CACCC| | | 662367 [Y] |TCTTT| | | 662365 [S] |GCGGG| | | 662364 [R] |AGAAA| | | 662360 [M] |CACCC| | | 662359
Leave a comment:
-
Sorry for the late response, had a conference away in LA, but after playing with the script and using warnings I have figured out that even though when I print out only the $position, do not use STDIN for orf_beg, or redefine $position not to include decimals, the script tells me this..
Use of uninitialized value in string gt at gamma.pl line 25, <IN> line 1.
Use of uninitialized value in string gt at gamma.pl line 25,...Leave a comment:
-
I am currently working on the foreach and while/if suggestions you guys provided, thanks! To answer some questions: the position is a number, it doesnt show when I copy and pasted the text, but there is a lot of white space between the last number of the position and the sequence character to allow for the fact that on occasion there will need to be decimals due to the format of the file. I checked all of the substring column numbers before posting,...Leave a comment:
-
Thats not the variable that perl isnt recognizing, the $position is the problem, I defined orf beg before opening the file handle so that during the loop it wouldnt ask me to input the start of the ORF before every iteration.Leave a comment:
-
How to get a while loop to recognize an extracted number
I am writing a fairly simple script that is supposed to print out lines from a txt file and group them based on where I want them. The general format of the files I am using the script on is as follows:
662376 [S] |GCGG | | |
662375 [S] |CGCC | | |
662374 [S] |GCGG | | |
662373 [H] |CATC | | |
662371 [Y] |TCCC | | |
662369 [M] |CACCC| | |
... -
The errors were
Scalar found where operator expected at alpha.pl line 4, near "$|"
(Missing semicolon on previous line?)
Bareword found where operator expected at alpha.pl line 9, near "$file_q = "/home"
(Might be a runaway multi-line // string starting on line 5)
(Missing operator before home?)
String found where operator expected at alpha.pl line 11, near...Leave a comment:
-
Thanks, I've been fiddling with your suggestions, only problem is the final set of code you said to insert after the shebang line just forces the script to give me a lot of errors instead of doing anything, basically I just want it to not repeat the first 10 characters of sequence over again, and dont know exactly how to set up the shift function, any help with that would be greatLeave a comment:
-
Usage of shift command
So I'm fairly new at perl and was looking for help with the usage of the shift command, which I think will help me solve a problem I've been having. Here is my script as is:
...Code:#!/usr/bin/perl #print "Where is the output file located?"; #chomp($file_q = <STDIN>); $file_q = "/home/asession/pracperl/x.txt"; open(FILE, $file_q) ||die "nope\n"; while(<FILE>){ -
Thanks! I've done a bit more manipulation to get it to do exactly what I want, your help is greatly appreciated!Leave a comment:
-
Basically the format of my data is like this, but contains closer to like 10,000 lines.
cere 662376 G
para 662376 C
baya 662376 x
cere 662375 C
para 662375 G
baya 662375 x
cere 662374 G
para 662374 C
baya 662374 x
cere 662373 C
para 662373 A
baya 662373 x
cere 662372 A
para 662372 A
...Leave a comment:
-
2 questions for perl text manipulation
I've just started programming in perl and have written a few successful scripts but had a quick question on how to do 2 things.
First here is a script that I wrote recently that works for what it is supposed to do, but is not quite what I want.
...Code:#!/usr/bin/perl $file_q = "x.txt"; open(FILE, $file_q)||die "nope\n"; while(<FILE>){ @line = split(/\s+/,
No activity results to display
Show More
Leave a comment: