Irfan Sayed wrote: > Hi All, > > I am stuck on parsing file name if it has space. > I have file name as : file system.proj > now this file contains space between worf file and system > > now i want to do ceratin operation on this file > but whenever i give this file name in any command then it fails saying that > file does not exist. it is only considering file word and not the whle file > name. > > i dont know how to handle this sitiuation . i tried applying double quotes to > file name but no luck. > > here is my actual code: > > $vd="file system.proj"; > $svn = "svn delete $vd";
I don't understand why you have 'file' before the filename. When I delete something from my repository, I do it like this (at the Unix command line): % svn delete path/to/file.name or; % svn delete path/to/dir (we'll ignore the co command for now). So, if I were to come up with something to throw in a variable for your example, I'd build (at minimum) something like this (untested): ---- code ---- use warnings; use strict; my $file = "path/to/system.proj"; svn_delete($file); sub svn_delete { validate_file_name($_); # outside the scope of example validate_svn_exist($_); # outside the scope of example my $svn_file_to_delete = shift; my $svn_delete_command = "svn delete ${svn_file_to_delete}"; system($svn_delete_command); } ---- end code ----- ...and then IMMEDIATELY follow that up with: % svnversion % svn log % svn diff Until you can be sure that your code doesn't *ever* do the wrong thing. I don't think it's wise to toss repository commands into a non-descriptive variable such as $svn. If that var is ever used again by accident (in, or out of scope), you could be in trouble. Steve ps. Thanks Chas, for the interpolation reminder. pps. I immediately saw where 'unless' would be a fantastic addition to my above sample code...I'm just hoping that by avoiding writing it in, I wouldn't be caught on my last post, because no one ever reads a pps.
smime.p7s
Description: S/MIME Cryptographic Signature