Sponsored Content
Full Discussion: perl if condition problem
Top Forums Shell Programming and Scripting perl if condition problem Post 302343699 by jnetnix on Thursday 13th of August 2009 10:13:00 AM
Old 08-13-2009
If it works fine when you remove the test for $proc the first thing that comes to mind is something is inside the scalar that you're not anticipating...like a newline or control character.

Try printing with tags to make sure nothing is hidden.
Code:
print "\$proc = <$proc>\n";

Goood Luck!
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

problem with if condition

hi, :) pls consider the following if statement if //g') ] then ........ else ....... when i execute the script i am getting the following error '(' unexpected I am not able to find the mistake. could anybody tell where i did mistake. cheers RRK (13 Replies)
Discussion started by: ravi raj kumar
13 Replies

2. Shell Programming and Scripting

problem in if then else condition

Hi , I am trying the following simple script . But it is always giving 1 output. Dont know why #!/bin/sh find . -name "a.log" if ; then echo "1" else echo "0" fi Kindly advice. it is giving 1 output even when the a.log file is not there (26 Replies)
Discussion started by: himvat
26 Replies

3. Shell Programming and Scripting

Condition statement in perl

#!/usr/bin/perl $output1 = "/home/log.txt" $output2 = "/home/grep.txt" #Statement1 creates an output file called log.txt. #Statement2 greps a line from log.txt and store the result in grep.txt I want to create a condition where if the file grep.txt is empty repeat process. Thanks. (1 Reply)
Discussion started by: sureshcisco
1 Replies

4. Shell Programming and Scripting

If condition problem

Hi, I need to use if condition for search a file pattern on a particular location. cd $file_Path if || then do this else do that fi Can someone help me with the if part, how i can put those conditions? make sure format should be *.file* and *.file file is a keyword which i... (5 Replies)
Discussion started by: amit.mathur08
5 Replies

5. Shell Programming and Scripting

Perl Array Condition

Hello, I want to check if all element of an array have the same value regardless the length of the array. example: @array1 = qw(44 44 44 44); @array2 = qw(55 55 55 55 55 55 55); Please advice, Ahmed (11 Replies)
Discussion started by: ahmed_zaher
11 Replies

6. Shell Programming and Scripting

if condition problem!

Hi All, I'm a newbie here, I'm just wondering how can i disable my 1st sed command if there's no file found on Yes_Directory and process instead the No_Directory because there's a file found on it. Yes_Directory="/home/yes/ No_Directory="home/no/ script: if ; then sed -i... (8 Replies)
Discussion started by: nikki1200
8 Replies

7. Shell Programming and Scripting

perl -Calling the Subroutine Only if the condition is met

Hello All, I am in the process of learning perl.I have a perl script and based on the arguments passed it would the appropriate subroutine that is defined in the script. Now, I need to check a value that is defined in the Environment variables and should call the subroutine only if the... (1 Reply)
Discussion started by: filter
1 Replies

8. Shell Programming and Scripting

If condition problem

Hi All, I am using below if condition to check whether null is passed as a parameter to the program if or ; then echo "ABC">>$FILE else echo "CDF">>$FILE fi However it is saying me null=null command not found . Please help me with this (9 Replies)
Discussion started by: Hypesslearner
9 Replies

9. Shell Programming and Scripting

Condition problem

Hi All, Seeking for your assistance on how to condition it correctly. cat file1.txt 290,1663,43,888,0,0.00,86.91,0.00,26.98,0.00 290,1663,52,0,0,0.00,0.00,0.00,0.00,0.00 290,1663,52,888,0,0.00,34.60,0.00,9.00,0.00 1st scenario: if the fourth column contains 888s and 0s it is by... (16 Replies)
Discussion started by: znesotomayor
16 Replies
Poet::Util::Debug(3pm)					User Contributed Perl Documentation				    Poet::Util::Debug(3pm)

NAME
Poet::Util::Debug - Debug utilities SYNOPSIS
# In a script... use Poet::Script; # In a module... use Poet; # Automatically available in Mason components # then... # die with value dd $data; # print value to STDERR dp $data; # print value to logs/console.log dc $data; # return value prepped for HTML dh $data; # same as above with full stacktraces dds $data; dps $data; dcs $data; dhs $data; DESCRIPTION
These debug utilities are automatically imported wherever "use Poet" or "use Poet::Script" appear, and in all components. Because let's face it, debugging is something you always want at your fingertips. However, for safety, the short named versions of these utilities are no-ops outside of development mode, in case debug statements accidentally leak into production (we've all done it). You have to use longer, less convenient names outside of development for them to work. UTILITIES
Each of these utilities takes a single scalar value. The value is serialized with Data::Dumper and prefixed with a file name, line number, and pid. e.g. dp { a => 5, b => 6 }; prints to STDERR [dp at ./d.pl line 6.] [1436] { a => 5, b => 6 } The variants suffixed with 's' additionally output a full stack trace. dd ($val), dds ($val) Die with the serialized $val. dp ($val), dps ($val) Print the serialized $val to STDERR. Useful in scripts. dc ($val), dcs ($val) Append the serialized $val to "console.log" in the "logs" subdirectory of the environment. Useful as a quick alternative to full-bore logging. dh ($val), dhs ($val) Returns the serialized $val, surrounded by "<pre> </pre>" tags. Useful for embedding in Mason components, e.g. <% dh($data) %> Live variants Each of the functions above must be appended with "_live" in order to work in live mode. e.g. # This is a no-op in live mode dp [$foo]; # but this will work dp_live [$foo]; SEE ALSO
Poet AUTHOR
Jonathan Swartz <swartz@pobox.com> COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Jonathan Swartz. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-06-05 Poet::Util::Debug(3pm)
All times are GMT -4. The time now is 06:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy