On Fri, 13 Feb 2004 17:54:54 +0530
Vishal Vasan <[EMAIL PROTECTED]> wrote:

> Hi All,
> 
> I have a file with the following contents (temp.txt).
> A1110
> G1115
> B1110
> C1111
> D1111
> E1113
> F1115
> and so on. I have to read the contents from this file and create 2 
> seperate files. The 1st file contains the lines ending with 0 and 1 
> while the 2nd file contains the lines ending with 3 and 5. I can do
> this easily by creating a seperate perl script. But I have a
> constraint. I should not write a seperate file to do this processing.
> 
> I am calling the perl from a shell script. Is there any way of calling
> 
> the Perl program "in-line" with all the required parameters? "In-line"
> 
> means no seperate file containing the script.
> 
> Is it worth doing this? Is there a better way of doing it?

You can do all the stuff in one perl-script. You can just put it on top
of the data:

#!/path/to/perl -w

# Your perl-code goes here

DATA

A1110
G1115
B1110
C1111
D1111
E1113
F1115
...

--------------------------

Then you can treat the file's content after the line 

DATA

as a file by using the filehandle <DATA> to read from it.


Kind regards,

Benjamin

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to