chop():
The chop function is used to remove the last character of any element.
I have taken the example of array and then applied the chop() function on it.
The chop function is used to remove the last character of any element.
I have taken the example of array and then applied the chop() function on it.
#! /Perl/bin/perl
@array=(aa,bb,cc,dd,ee,fd,gf,hg,sd);
print("Array before chopping\n");
print("@array\n");
chop(@array);
print("\nArray after chopping");
print("\n@array");
@array=(aas,bbsd,ccdsf,dddff,eefd,fdg,gfg,hggjh,sdhh);
print("\nArray before chopping\n");
print("@array\n");
chop(@array);
print("\nArray after chopping");
print("\n@array");
Output:@array=(aa,bb,cc,dd,ee,fd,gf,hg,sd);
print("Array before chopping\n");
print("@array\n");
chop(@array);
print("\nArray after chopping");
print("\n@array");
@array=(aas,bbsd,ccdsf,dddff,eefd,fdg,gfg,hggjh,sdhh);
print("\nArray before chopping\n");
print("@array\n");
chop(@array);
print("\nArray after chopping");
print("\n@array");
0 comments:
Post a Comment