Re: Removing a space from file name
Smoot Carl-Mitchell via beginners <[email protected]> Wed, 19 Feb 2025 18:03:34 -0700
| Newsgroups | gmane.comp.lang.perl.beginners |
|---|---|
| Message-ID | <[email protected]> |
On Thu, 2025-02-20 at 08:01 +0800, walt via beginners wrote:
> >=20
> > Something like:
> >=20
> > while (<*>) {
> > rename $_, "$1$2.jpg" if $_ =3D~ /(.+) (.+)\.jpg/;
> > }
> >=20
>=20
> what does <*> mean here?
<*> iterates over the current directory and returns every filename in
the directory to the $_ variable. The '*" can be any glob pattern. e.g.
for the specific jpg files in the example, I could have used <*.jpg>
--=20
Smoot Carl-Mitchell
System/Network Architect
voice: +1 480 922-7313
cell: +1 602 421-9005
[email protected]
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/