Perl-extraction using windows cmd

Hi, I need to extract

Password expires

from the output of windows command

print `net user %USERNAME% /domain`;

in perl. So i want to redirect the output of this win-cmd to a file and try extracting

Password expires

along with its value. i'm trying with this code but getting errors.

#!usr/bin/perl
use warnings;
use strict;
print `net user %USERNAME% /domain` >out.txt;

Requesting help.

The first thing I noticed was the wrong shebang/hashbang line, it should be #!/usr/bin/perl , but since you are running your script on Windows, it is ignored anyway.

Regarding your issue with output redirection, I suggest to try this:

print `net user %USERNAME% /domain >out.txt`;

Let me know if that worked.

Regarding the extraction part, I suggest doing it in Perl on-the-fly, without redirecting it to outfile first.
If you need help with this, you'll need to post a full sample output of the mentioned net user command.

Hope this helps.