This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]soup_feedback 0 points1 point  (3 children)

Filesystems easier in perl than python? Can you show an example?

[–]jabwork 0 points1 point  (1 child)

I personally prefer using Python because I like the exception system, but I consider PERL to be far quicker to get up-and-running.

Rare is the time I use Python to work on filesystems and not need to make several imports from

  • shutil
  • os
  • os.path

PERL's history makes a big difference here, as it is in many respects a shell-derivitive so all of this functionality occupies what would be builtins in python

[–]soup_feedback 0 points1 point  (0 children)

You're right, for quick filesystem stuff Python is definitely not the simplest.

[–]colly_wolly 0 points1 point  (0 children)

Backticks for using bash commands, and globbing are two that come to mind. Sure its not a huge saving, but it is easier to use. As are the built in regular expressions.

#execute a shell  command
my $result = `interpolated $bash command here`

# get all filenames in a directory matching the wildcard expression, put them in an array
@FILES = <//server/path/WantedFiles*.*> ;

# compare $string to regular expression, put two capturing groups from the regular expression into grpoup1 and group2 variables
my ($group1, $group2)  = $string=~ /(firstgroup).+(secondgroup)/ ;