Ask a Question related to PERL Beginners, Design and Development.
-
Bob Showalter #1
RE: How to call perl with in-line contents?
Vishal Vasan wrote:
Yes, do something like this (assuming a Bourne-type shell; others will have> 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.
to help you with csh):
#!/bin/sh
...
perl <<'EOT' - input.dat
while(<>) {
...
}
EOT
The "-" means that your script is coming from STDIN. See perldoc perlrun.
How about using awk?>
> Is it worth doing this? Is there a better way of doing it?
awk '/[01]$/ {print >>"01.dat"} /[35]$/ {print >>"35.dat"}' input.dat
Bob Showalter Guest
-
PLJava - Perl embeded into Java (calling Perl from Java) - 1sr release - call for tests and review, please.
Recently on perlmonks.com I have posted a prototype of Perl embeded into Java (#372197="Embeding Perl into Java to use CPAN modules directly from... -
How to package the _Inline folder contents in an exe produced using Perl.
Hello, I am using Inline::C module to call few C functions from my perl application. When I am building my perl application an _inline folder is... -
How can I call MFC functions from Perl
Hello, How can I call MFC functions from Perl? Which module / method I should select? Inline:C ? Inline:CPP ? XS ? or SWIG? Regards, Sankaran -
NT: perl 5.8.0: system call - commnad split into multiple line ?
Greetings, I am fairly new to Perl. I downloaded Perl 5.8.0 for NT/Win2000 platform. I want to copy file from server1 to server2 using... -
Call SP from command line
I am running a load test on a SQL server and I want to call a stored procedure from the command prompt using ISQL. I also want to be pipe in...



Reply With Quote

