Sunday, February 27, 2022

Perl example of splitting

 @thislist = ("a/apple", "b/banana/g", "c/cherry/d/f");

print(@thislist);

foreach $myFile (@thislist) {

@myList=split( '/', $myFile);

   $size = @myList;

   print("$size \n");

   print("@myList \n")

}

output

a/appleb/banana/gc/cherry/d/f2 

a apple 

b banana g 

c cherry d f 


tried at https://www.learn-perl.org/


Passing array into subroutine, finding max, min

passing array references to subroutines

referencing and dereferencing

No comments: