473,583 Members | 3,156 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

unix pipes to perl scripts


Got a problem piping command output to a perl script, in the test below
the loop accepts the piped files but it also interferes with my STDIN!

===test======== =============== ======
$ls -1 *.cfg | ./pp
ls -1 *.cfg | ./pp
file: hosts.cfg
file: pseries.cfg

type something : you typed :
===test======== =============== ======

I do not get the chance to type something in after "type something"...

Do i have to flush some variable inbetween the foreach loop and
<STDIN>?
Is looping trough <ARGV> or <> the best way to catch piped input?

===code======== =============== ======
$cat ./pp
#!/usr/bin/perl

while ( <ARGV> ) {
print "file: $_";
};

print "\ntype something : ";
$answer = <STDIN>;
print "you typed : $answer \n";
===code======== =============== ======

thanks!

Jul 19 '05 #1
1 4312
how about this

$ls -1 *.cfg | perl -ne '
print "file: $_";
while(<> ){
print "file: $_";
};
print "\ntype something : ";
$answer = <STDIN>;
print "you typed : $answer \n";
'

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5061
by: Sandman | last post by:
The subject says it all. I am doing a: I have a perl script in which I am using a ReadParse routine that parses the $ENV{'QUERY_STRING'} or $ENV{'CONTENT_LENGTH'} which are two variables passed to the script under usual SSI (.shtml) containing form data submitted to the page from which the script is executed from. Well, since switching to...
0
1393
by: rk | last post by:
Hi, I'm looking for some kind of software which can give cgi/perl scripts autmatically based on the user input to the web page so that each web page can be made dynamic page once the software gives the server side scripts. Immediate responsed on this highly appreciated. Thanks
1
1642
by: Bill Cunningham | last post by:
Can one (I know nothing about perl but I'm looking since xml) write perlscripts for a brower as such? <script language="perlscript" > Does this exist? Bill
0
1257
by: Gaizer | last post by:
I need to be able to use my perl scripts that use use XML::RSS; use XML::Parser; I have already installed an Apache server and LWP. I am using Windows XP. What should I install now for the above XML capabilities? And where can I find these XML programs? Thanks a million!
1
3732
nimisha m
by: nimisha m | last post by:
what are setuid/setgid perl scripts?
3
1568
fungazid
by: fungazid | last post by:
Hello guys, I have a Perl script that calls other Perl scripts: ### Main script: ### my @command; $command="step1.pl"; $command="step2.pl";
0
2089
by: ratcateme | last post by:
I am using apache 2.2.4 and perl 5.8.8 on Ubuntu 7.10 I am creating a website mainly in PHP but i have a few perl scripts i want to run. I am running a simple script but get this error a Internal Server Error 500 the apache error.log file says: (2)No such file or directory: exec of '/var/www/cgi-bin/test.cgi' failed Premature end of...
2
1997
by: jagjot | last post by:
hey Can anybody tell me How to convert my perl scripts in binary executables? Which command should I make use of? Please revert back as soon as possible and if possible drop me a mail at EMAIL REMOVED
223
7187
by: Pilcrow | last post by:
Given that UNIX, including networking, is almost entirely coded in C, how come so many things are almost impossible in ordinary C? Examples: Network and internet access, access to UNIX interprocess controls and communication, locale determination, EBCDIC/ASCII discrimination, etc. Almost all of these are easy in Perl. Why isn't there a...
31
2727
by: happyse27 | last post by:
Hi All, How create OOP perl scripts and how to let users select different ouput html template to display the photo that they upload? Including the urls to refer to. Kindly advise... Cheers..
1
7936
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8195
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6581
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5701
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5375
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3820
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3845
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2334
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1158
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.