44.193.29.184 |    

Navigation

Google Advertisement

Die Funktion array_space() wandelt ein Array in einem String um und füllt den Raum zwischen den Array Elementen mit ein definierten Zeichen.

array_space
  1. # **************************************
  2. # fill out space between array entrys...
  3.  
  4. @num = (1..5);
  5. print array_space( '|', @num ); # 1|2|3|4|5
  6.  
  7. sub array_space {
  8.  
  9. my ($sep, @temp)=@_;
  10. my $str;
  11.  
  12. if ( $#temp>0 ) {
  13.         foreach my $tmp( @temp ) {
  14.                 $str.=$tmp;
  15.                 $str.=$sep unless ( $tmp eq $temp[$#temp] );
  16.         }
  17. }
  18. return $str;
  19.  
  20. }
  21.  
Parsed in 0.001 seconds at 299.73 KB/s

Search
 
Full text search by name and content of a snippet.

User online
There are 2 users online.

Tags Cloud

Latest snippets
str2seconds
(Bash::Function)
is_integer
(Bash::Function)
file_rotate
(Bash::Function)
confirm
(Bash::Function)
is_workingtime
(Bash::Function)
last day of last month
(Bash::Snippets)
crypt_apr1_md5
(PHP::Function)
crypt_apr1_md5
(Perl::Function)
transparent
(CSS)
rfc2822Toiso8601
(PHP::Function)