Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: keid
  • Order by date
  1. keid

    arrays with 2 ENDs

    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...
  2. keid

    Printing elements of an array

    Thanks alot that really worked well and it was quick. Many thanks Kozhaya
  3. keid

    Printing elements of an array

    foreach $i (@vals) { print"%10d",$i; } I know it does not work in this way, but i need a hint to start with.
  4. keid

    Printing elements of an array

    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
  5. keid

    Search and Replace in an existing file

    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
  6. keid

    Search and Replace in an existing file

    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) {...
  7. keid

    Search and Replace in an existing file

    I have 2 files file1sample ------------------------- NODE / 563 90. .0 .0 NODE / 564 80. .0 .0 NODE / 565 70. .0 .0 NODE / 566 60.0 .0...
  8. keid

    foreach and if loops

    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...
  9. keid

    foreach and if loops

    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...
  10. keid

    Array manipulation

    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...
  11. keid

    Need help with tabular data

    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
  12. keid

    Array manipulation

    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
  13. keid

    Array manipulation

    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...
  14. keid

    string matching

    Please can you help me in adjusting the code to fit in my loop.
  15. keid

    string matching

    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/^\#/))) {...
  16. keid

    string matching

    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...
  17. keid

    string matching

    The forward slash if fixed with (\S), but now i need to store the title K MOBIL in addition to the values 0 1. 1. .0 .0 next to the 10516 .
  18. keid

    string matching

    I have another problem with the forward slash as in this example FUNCT / 10516 0 1. 1. .0 .0 NAME K MOBIL -3. .0 .0 .0 .001 500...
  19. keid

    string matching

    Thanks Guys alot, it was really helpful. I am new to perl only one month practice with oreilly learning perl. Can you give me advice about perl books?
  20. keid

    string matching

    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 . . .

Part and Inventory Search

Back
Top