Hello
I have to store 2 arrays out of the lines starting with part after the line of the CNTC 205
CNTC 205
PART 1 2
END
PART 4
END
in other words i need to make a set of parts
@first_part of CNTC 205= 1 2
@second_part of...
Hello
I want to print the elements of a big array,in such a way each 10 elements on a line and each elements has a 10 digits space %10d.
thanks alot in advance
Kozhaya
What about if the last number is not zero does it work with (\d)$?
+< for file1.txt works as expected adding new data without deleting old data. But I wish to do inline editing by changing the values, do u suggest s///?
many thanks
sure
I tried s/// but did not do the job coz 0 is found somewhere else
open(DAT_A, "+<file1.txt") || die("Could not open file1");
open(DAT_B, "file2.txt") || die("Could not open file2");
@pc_data=<DAT_A>;
@nodal_data=<DAT_B>;
foreach $node (@nodal_data)
{
foreach $data (@pc_data)
{...
I dont want any specific output but storing these values
I need to search for keyword RBODY and print the next line after it
[code]
@data=<DATA>;
foreach $elem (@data) {
if ($elem=~ m/RBODY/) {
print $elem;
next;
if ($elem=m/NAME/) {print $elem;}
}
}
[\code]
I tried this on this sample...
If I have read a file as an array (probably not a good way for memory in case of big files). How can I move to the next line after matching a word in the if statement in this case?
@data=<DATA>;
foreach $elem (@data) {
if ($elem= ~ m/^RBODY /)
{
exp; #storing info from $elem
#how can i...
Hello
first I would like to thank you guys for ur help. This is giving us much interest in the perl and its wider capabilities.
As output to this program, I just needed a sorted array containing @NODs which are not in @DELNOD.
this is the code i used to do it, it is simple up to the level of...
my is used only forcreating private variable i, without it some warnings will appear. while $#data stands for the index value of the last element of the array data ie the array length.
note for loops ( init value; test condition; increment)...,
hope this helps from a beginner like me
I tried push pop shift unshift as these are used on the beginning or end of arrays. I added my code to give u an idea of what I did, but it is not working
any other ideas
I have a file containing something like that
NOD 111:119
NOD 11 12 13 14 15 16 17 18 19 20
NOD 101:109 91:100
DELNOD 21:29 2 3
111:119 means nodes 111 112 ... 119
so I have to sort the (array or hash) of NODs then romove the array of DELNOD...
I used this code for searching for keyword, probably not a good way but I managed to get some info until i get stuck with the FUNCT END
@pc_file_original= <DATA>;
$i = 0;
foreach (@pc_file_original)
{
chomp($_);
$_ =~ s/\s+$//;
if(!(($_=~ m/^\$/) or ($_=~ m/^\#/)))
{...
Dear rharsh
I dont understand what do you mean by these lines, if you can give me brief explanation of how to address each element of the hash
$records{$label}{name} = $name;
records{$label}{data}{$x} = $y
$records{$label}{data}{$key}
%{$records{$label}{data}})
Any useful reference book u...
Thanks Michael
Actually in my file, there is many curve functions with different curve ID, and next to this ID it specifies for me how many lines before the END.
so i need to print on the output file something like that
Curve number xxx
abs coord
.
.
.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.