#!/usr/bin/perl -w
# @seznam_datotek = </db/base_home/VNOS/PO5/*.po5>; #podana pot
# @seznam_datotek = ; #podana pot
@seznam_datotek = <*.a>;
foreach $i (@seznam_datotek)
{
print "--- $i \n";
}
# ali
while ( my $file = <*.a> ) {
open(FILE, $file) || die "Can't open $file: $!";
# delaj s fajli - spodaj je izpis seznama datotek
print "$file \n";
close FILE;
}
#!/usr/bin/perl -w
@seznam_datotek = </db/base_home/VNOS/PO5/*.po5>;
foreach $i (@seznam_datotek)
{
print "--- $i \n";
#$i=/db/base_home/VNOS/PO5/ #split razbije pot po slesih /
@pot = split("/", $i);
print "@pot[1], @pot[2]\n";
$info = "Caine:Michael:Actor:14, Leafy Drive";
@personal = split(/:/, $info);
}
#which has the same overall effect as
@personal = ("Caine", "Michael", "Actor", "14, Leafy Drive");
#If we have the information stored in the $_ variable then we can just use this instead
$_= ("Caine", "Michael", "Actor", "14, Leafy Drive");
@personal = split(/:/);
#If the fields are divided by any number of colons then we can use the RE codes to get round this. The code
$_ = "Capes:Geoff::Shot putter:::Big Avenue";
@personal = split(/:+/);
#If we have the information stored in the $_ variable then we can just use this instead
@personal = split(/:/);
#If the fields are divided by any number of colons then we can use the RE codes to get round this. The code
$_ = "Capes:Geoff::Shot putter:::Big Avenue";
@personal = split(/:+/);
#is the same as
@personal = ("Capes", "Geoff",
"Shot putter", "Big Avenue");
#But this:
$_ = "Capes:Geoff::Shot putter:::Big Avenue";
@personal = split(/:/);
#would be like
@personal = ("Capes", "Geoff", "",
"Shot putter", "", "", "Big Avenue");
#A word can be split into characters, a sentence split into words and a paragraph split into sentences:
$word="abcdeggg"; $sentence="ta split pa je super"; $paragraph="ta odstavek deluje";
@chars = split(//, $word);
@words = split(/ /, $sentence);
@sentences = split(/\./, $paragraph);
#In the first case the null string is matched between each character, and that is why the @chars array is an array of characters - ie an array of strings of length 1.
Stevilo obiskov:
.
Za astronomski krožek: ZORKO Vičar
RFC-822: Zorko.Vicar@guest.arnes.si