![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Regarding redirection using cat. | marconi | UNIX for Dummies Questions & Answers | 2 | 08-21-2008 05:02 AM |
| redirection | DNAx86 | Shell Programming and Scripting | 9 | 04-18-2008 02:24 PM |
| sed redirection | myle | UNIX for Dummies Questions & Answers | 3 | 03-12-2008 07:04 PM |
| Help with redirection | Shallon1 | High Level Programming | 2 | 12-12-2001 07:35 AM |
| redirection to tty** with cat | zorro | UNIX for Dummies Questions & Answers | 1 | 11-02-2001 11:23 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Perl Redirection
Hi,
I have a Perl script that finds some files based on some criteria and then it processes the file contents using some logic. Extract: Code:
print "Started ... "; my $command = "<unix command>"; @arr=`$command`; $size=@arr; print "Size: ".$size Use of uninitialized variable in line number so and so after the initial lines are printed. My question is that whenever I redirect the output of this script to some text file the debug warnings are written to the text file before the print statement in red is printed. The flow of the script also does not conform to this weird behavior. Any idea folks? Thanks. |
|
||||
|
You should always have
Code:
use strict; use warnings; Once there, listen to their error & warning messages and clean them up. "Use of uninitialized variable in line number so and so" is telling you that you are trying to print a variable with no value. Use an 'if' condition to test this before you print it or initialize the variable with some value by default. To remove this message from your output, redirect stderr when you submit your script. Code:
./myprog 2> /dev/null |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|