Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Nov 2001 11:53:55 +1100
From:      Gavin Cameron <gavin@mercury.itworks.com.au>
To:        Chris Aitken <chris@ideal.net.au>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: Perl on FreeBSD
Message-ID:  <20011113005355.GA36434@mercury.itworks.com.au>
In-Reply-To: <5.1.0.14.2.20011113111839.03949520@mail.ideal.net.au>
References:  <5.1.0.14.2.20011113111839.03949520@mail.ideal.net.au>

next in thread | previous in thread | raw e-mail | index | archive | help
#!/usr/bin/perl -w

while (<>)
{
  print;
}

Transfers standard input to standard output.  Replace print inside the while
loop to do whatever you want. The line read in is stored in $_ in this
example.

Gavin

On Tue, Nov 13, 2001 at 11:19:47AM +1100, Chris Aitken wrote:
> Hi everyone....
> 
> 
> I have a curley on I havent been able to work out.
> 
> What I want to be able to do is take the output of a FreeBSD command, and 
> pipe the output to a perl script so I can use that data....
> 
> For example. If I ran the following at command line,
> 
> # echo "Blah Blah Blah" | perlscript.pl
> 
> How would I be able to print "Blah Blah Blah" to the screen from the perl 
> script. I am only new to perl and have been doing alot of funky mrtg stuff 
> opening files and commands within the perl script and taking the output, 
> but im stumped on how to pipe data to a perl script and use that data in 
> the perl script.
> 
> 
> Any assistance would be great.
> 
> 
> 
> Thanks
> 
> 
> Chris
> 
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011113005355.GA36434>