|
Prev: PERL to mean what 'perldoc perl' says is wrong? (was: Re: perlshould be improved and perl6)
Next: Can "perldoc" take input from a pipe?
From: Tad J McClellan on 15 Apr 2008 21:47 Marek <mstep(a)podiuminternational.org> wrote: > my $pix_unused_pix = > "/Users/xyz/Documents/webpages/www.myproject.de/pix/fotos/thumbnails/ > tn_munich17.jpg"; Look Ma! No wordwrap! my $pix_unused_pix = '/Users/xyz/Documents/webpages/www.myproject.de/' . 'pix/fotos/thumbnails/tn_munich17.jpg'; > if ( !-e $pix_out_folder ) { unless ( -e $pix_out_folder ) { > $first_sub = $pix_out_folder . '/' . $first_sub if $first_sub; $first_sub = "$pix_out_folder/$first_sub" if $first_sub; -- Tad McClellan email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
From: Lawrence Statton on 16 Apr 2008 10:09 Tad J McClellan <tadmc(a)seesig.invalid> writes: > > (and whitespace is not a scarce resource, so use some!) > You young'ns don't remember the great whitespace shortage of '03 .... all the new python people were using all the whitespace that could be produced -- a lot of programmers had to go mining in old COBOL and FORTRAN projects of their college days just to get enough whitespace to keep our variables separated. -- Lawrence Statton - lawrenabae(a)abaluon.abaom s/aba/c/g Computer software consists of only two components: ones and zeros, in roughly equal proportions. All that is required is to place them into the correct order.
From: Marek on 16 Apr 2008 13:04 Sorry to bother this group again! Now my script is nearly finished. Only one little problem is left: I am imaging the perl "rename" like the shell "mv". Is there a difference? My rename is not working as intended: could not rename your pix from: /Users/marekstepanek/Documents/webpages/www.munich-taxis.de/ pix/fotos/thumbnails/tn_munich28.jpg to /Users/marekstepanek/Documents/webpages/www.munich-taxis.de/ pix_out/fotos/thumbnails/tn_munich28.jpg Here the last version of my script. Best greetings marek *************** #! /usr/local/bin/perl use strict; use warnings; my $start_dir = "/Users/xyz/Documents/webpages/www.munich-taxis.de"; my $pix_out_folder = "$start_dir/pix_out"; my @unused_pix = ( "/Users/xyz/Documents/webpages/www.munich-taxis.de/pix/fotos/ thumbnails/tn_munich28.jpg", "/Users/xyz/Documents/webpages/www.munich-taxis.de/pix/grafix/chp1/ no_n.gif", "/Users/xyz/Documents/webpages/www.munich-taxis.de/pix/grafix/chp5/ hili_-09.gif", "/Users/xyz/Documents/webpages/www.munich-taxis.de/pix/grafix/ norm_upb.gif", "/Users/xyz/Documents/webpages/www.munich-taxis.de/pix/grafix/ hili_upb.gif", "/Users/xyz/Documents/webpages/www.munich-taxis.de/pix/grafix/chp5/ hili_-08.gif", "/Users/xyz/Documents/webpages/www.munich-taxis.de/pix/grafix/ norm_dn.gif", "/Users/xyz/Documents/webpages/www.munich-taxis.de/pix/grafix/chp2/ hili_subchap10.gif", "/Users/xyz/Documents/webpages/www.munich-taxis.de/pix/grafix/chp2/ hili_db.gif", "/Users/xyz/Documents/webpages/www.munich-taxis.de/pix/grafix/chp2/ norm_up.gif", "/Users/xyz/Documents/webpages/www.munich-taxis.de/pix/grafix/chp5/ hili_subchap07.gif", "/Users/xyz/Documents/webpages/www.munich-taxis.de/pix/grafix/ no_fr.gif", "/Users/xyz/Documents/webpages/www.munich-taxis.de/pix/grafix/chp5/ hili_-11.gif", "/Users/xyz/Documents/webpages/www.munich-taxis.de/pix/grafix/chp5/ acti_subchap10.gif", "/Users/xyz/Documents/webpages/www.munich-taxis.de/pix/grafix/ rahmen_unten01_10.gif", "/Users/xyz/Documents/webpages/www.munich-taxis.de/pix/grafix/chp4/ hili_subchap10.gif", "/Users/xyz/Documents/webpages/www.munich-taxis.de/pix/grafix/chp5/ acti_subchap08.gif", "/Users/xyz/Documents/webpages/www.munich-taxis.de/pix/grafix/chp5/ hili_up.gif", "/Users/xyz/Documents/webpages/www.munich-taxis.de/pix/grafix/chp5/ hili_subchap05.gif", "/Users/xyz/Documents/webpages/www.munich-taxis.de/pix/grafix/chp2/ hili_up.gif", "/Users/xyz/Documents/webpages/www.munich-taxis.de/pix/grafix/ hili_upn.gif", "/Users/xyz/Documents/webpages/www.munich-taxis.de/pix/grafix/chp2/ norm_tacho_ul_00.gif", "/Users/xyz/Documents/webpages/www.munich-taxis.de/pix/grafix/chp4/ hili_up.gif", "/Users/xyz/Documents/webpages/www.munich-taxis.de/pix/fotos/ munich04_03w.jpg" ); unless ( -d $pix_out_folder ) { mkdir $pix_out_folder or die "could not create your folder: $pix_out_folder! $!\n\n"; } foreach my $pix (@unused_pix) { my ($path) = $pix =~ m~/pix/([^"]+?)$~; my @folders = split( "/", $path ); # what happens if there is a deeper hierarchy? So we have to iterate over # all elements of @folders foreach my $sub (@folders) { last if $folders[0] =~ m~\.(jpe?g|gif|png)$~; $sub = shift @folders; $sub = "$pix_out_folder/$sub"; if ( $sub and !-d $sub ) { print "\nNO! Your folder \"$sub\" does not exists!\n\n"; mkdir $sub or die "could <not create your folder: \"$sub\"! $!\n\n"; } } } foreach my $pix (@unused_pix) { my $old = $pix; $pix =~ s~/pix/~/pix_out/~; my $new = $pix; rename $old, $new or die "could not rename your pix from:\n\t$old \nto\n\t$new\n\n $!"; }
From: J�rgen Exner on 16 Apr 2008 13:10 Marek <mstep(a)podiuminternational.org> wrote: >Only one little problem is left: I am imaging the perl "rename" like >the shell "mv". Is there a difference? My rename is not working as >intended: Did you read the documentation for rename()? I think it is very clear. >could not rename your pix from: > /Users/marekstepanek/Documents/webpages/www.munich-taxis.de/ >pix/fotos/thumbnails/tn_munich28.jpg >to > /Users/marekstepanek/Documents/webpages/www.munich-taxis.de/ >pix_out/fotos/thumbnails/tn_munich28.jpg You might want to include the reason _why_ the rename failed. That will probably give you some hint as to how to fix it. jue
From: Ted Zlatanov on 16 Apr 2008 14:29
Lawrence Statton wrote: > You young'ns don't remember the great whitespace shortage of '03 > ... all the new python people were using all the whitespace that could > be produced -- a lot of programmers had to go mining in old COBOL and > FORTRAN projects of their college days just to get enough whitespace > to keep our variables separated. Perl, fortunately, was not affected by this shortage by design :) Ted |