iphone has asked for the wisdom of the Perl Monks concerning the following question:
my $default_clientspec=`p4 info`; my $cspec = " "; #Getting the default cspec from perforce my @specs = split /\n/, $default_clientspec; foreach my $spec (@specs) { (my $param, my $val) = split /: /, $spec; if ($param =~ /Client\sname/xms) { #chomp $val; $cspec="$val\n";#only adding a new line character prints the v +alue in $cspec,why? #print "$cspec"; } } $cspec=lc($cspec); my $option_c=lc($options{c}); if (lc $cspec ne lc $options{c})#even though these two are equal,I see + the program entering the loop,I tried so many things ,not sure why? { print "$cspec"; print "$option_c"; print "ERROR:Please change your default cspec to $options{c}\n"; exit; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Strangely adding a "\n" character prints a variable
by davido (Cardinal) on Feb 03, 2011 at 08:18 UTC | |
by iphone (Beadle) on Feb 03, 2011 at 09:10 UTC | |
by davido (Cardinal) on Feb 03, 2011 at 09:21 UTC | |
by Anonymous Monk on Feb 03, 2011 at 12:58 UTC |