09 May 2006

Perl Code .

hay i was working a simple perl code . just have a look
__Start__

#!/usr/bin/perl -w

use strict;

$_="/home/deepak/deepak.html";

my @array=split /\//;
shift @array;
my $pop= pop @array;
print $pop,"\n";

my $new=join "/",@array;

print $new,"\n";

__END__

__OUTPUT__
deepak.html
home/deepak/

__END__

if i will use same code

__Start__

#!/usr/bin/perl -w

use strict;

$_="/home/deepak/deepak.html";

my @array=split /\/ /; ##here i have given a single space .
shift @array;
my $pop= pop @array;
print $pop,"\n";

my $new=join "/",@array;

print $new,"\n";

__END__

__OUTPUT__

/home/deepak/deepak.html

__Quote__
If the same code i will write in a copy , i think nobody will take bother of a single space .

No comments: