To all PERL Guru out there - Could you please give me a hand in converting this code to PERL and get it to do
the same with PERL....I'm new to PERL and know that it's
a very powerful language to process text files, or basically
anything you want on your PC. Please Help!!!
Below is a detailed explanation of what's needed in PERL.
I need to open, save and close 1200 very short files. They are strictly text files to be used in CNC machines, as job code for cutting metal on lathes.
When we transfer them to the machines, they won't run unless we have already opened them and saved them. We do not want to make any changes at all.
I can open a file in notepad, save it as the same name, and then close it. Then the machine will read it. I just have 1200 to do at a time.
Is there a way to automate this using PERL to open the files (1200) close it...(no changes will be made to the files, just a open and close for the file format specified...the server needs to see that the file was open inorder to process the jobs....)
the 'For ...' will automatically increment the file name for you
the 'intreal = freefile' statement will give you the next open file number to use so if someother app has used a specific number your app won't use it
the final close command will close all files opened by your app just in case and it won't hurt
Private Sub Command1_Click()
For varpart = 54000 to 55120
strpart = CStr(varpart)
strname = "c:\A" & strpart & ".min"
intreal = freefile
Open strname For append As #intreal
Close intreal
Loop
Close
End Sub
Alternative way with dir function...
fname = Dir("c:\*.min")
do while fname > ""
intreal = freefile
Open "c:\" & fname For append As #intreal
Close intreal
fname = Dir
Loop
Close
Thanks,
Ant
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.